How To Increase WordPress Loading Speed With Ajax Pagination

0 Flares 0 Flares ×

WordPress is an open source CMS (Content Managment System) lakhs of people use them daily. So we have to increase the WordPress loading speed in order to open the website within fewer seconds which makes visitors happy and hence visitors won’t be get irritated.We had already covered a successful post on WordPress loading speed and optimization and tested. Here is the link to the previous post

How To Optimize WordPress For Faster loading Time-Proven Tips

loading speed of wordpress

improve wordpress speed with ajax pagination

In the previous post we have covered

  • Setting up CDN (content Delivery Network) with a WordPress
  • Tweaked the .httaccess file like removing hotlinking( protect your images from bandwidth theft)
  • optimized images with the wp-minify and wp smush
  • Using cache plugin using the Wp-total cache
  • Enabling Gzip in the.httaccess

So Now we are moving ahead with adding the Ajax pagination effect in the WordPress blog.



  1. Log on to your WordPress
  2. Go to Editor in your WordPress dashboard

  1. Now you can see source files of your WordPress
  2. Find the header file (header.php) and click on it.
  3. Now you can see the header.php code, nowhere you have to add the following code before wp_head() function. You can find the wp_head() function by typing “CTRL +F” then type “wp_head()” and paste the following code before the header function.


<?php wp_enqueue_script('jquery'); ?>
// ajax pagination
jQuery('#wp_pagination a').live('click', function(){ // if not using wp_pagination, change this to correct ID
var link = jQuery(this).attr('href');
// #main is the ID of the outer div wrapping your posts
// #entries is the ID of the inner div wrapping your posts
jQuery('#main-container').load(link+' #entries')
}); // end ready function

  1. So after adding the code in your header.php and click save button.
  2. Finally, you have optimized the website faster with Ajax pagination which makes your site even faster.


Making your site faster makes your visitors happy, they will return back soon. Another Advantage of making website faster is you can free of CPU usage problem since most of the web host offers 25% of CPU usages only and you cannot use PHP request beyond 90 seconds. So if you have more CPU Usage, then you’re in trouble, you have to upgrade your shared hosting to VPS, Dedicated Server. I suggest making your website faster with the above techniques and make use of your resources efficiently.

If you like the post, keep sharing with your Friends. Be a Fan at our Facebook Fan page and Subscribe to Our Rss Feeds

0 Flares Twitter 0 Facebook 0 Google+ 0 0 Flares ×

11 thoughts on “How To Increase WordPress Loading Speed With Ajax Pagination

  1. Gr8 tip, let me try the ajax pagination.

  2. I have already shifted to VPS but then also I will try this. Thank you for sharing this 🙂

  3. really useful trick & i hope it will work for my blog also ..

  4. useful for WordPress users!

  5. Hi,
    I used the “CTRL +F” and typed in “wp_header.php” and it gave me a “ping” , however, I didn’t see the wp_header.php. Is “wp_header.php” the exact letters and symbols I’m looking for? Or am I just looking to put code in front of the beginning of the whole file?

    Would love to try this, but not being a technical person makes it difficult. If you are able to help, I’d appreciate it. Thanks. Sally

  6. Sally, you have drop the code inside the header.phpp

    1. enter into header.php code
    2. inside the header code find the wp_head() function. and paste the above code. and click save

  7. Hi, Suresh,
    a colleague of mine was recently asking me about ajax pagination and wordpress…I thought I saw the article about it on your blog..and, so, here I am, getting the tips in order to learn something more about it. As a matter of fact, it is smarter that I just send the link to my colleague!

  8. At the moment I’m using WP-Paginate plugin. The ajax pagination works if it’s on a page by itself but if I try to load it into the ajaxed div element it does not load the data.
    Does anybody know what could be a problem?

Leave a Reply

Your email address will not be published. Required fields are marked *