Web design Bristol | Web design South West
Call Web Trails: 07973 750 204

In the process of reviewing a site I discovered WordPress preloads unrequested pages with every requested page. In other words, if you click on a link to page 1, WordPress not only downloads and displays page 1 but also downloads another page as well. I am not entirely clear why. As you can image this impacts substantially on page delivery time.

For proof look at behind the scenes at the page source of any wordpress page with permalinks (Settings > Permalinks) set to anything other than default and you’ll see something like this in the header:

<link title="page 2" href="http://example.co.uk/page-2/" rel="prev" />
<link title="Page 4" href="http://example.co.uk/page-4/" rel="next" />

Now browse to the same page in Firefox. Inspect it using Firebug and you’ll see two pages are downloaded.

unrequested-page

 

Strange but true!

The solution is simple. Open your theme’s function.php file and add the following code:

add_filter( 'index_rel_link', 'disable_stuff' );
add_filter( 'parent_post_rel_link', 'disable_stuff' );
add_filter( 'start_post_rel_link', 'disable_stuff' );
add_filter( 'previous_post_rel_link', 'disable_stuff' );
add_filter( 'next_post_rel_link', 'disable_stuff' );

function disable_stuff( $data ) {
return false;
}

Try it yourself – You’ll be amazed.