A few months ago while debugging a Wordpress site and outputting queries into a log, I noticed that queries were getting fired for pages that I wasn’t even looking at. After a baffling search, I found out that Firefox was prefetching the next post based on the rel=”next” meta tag.
For example, on my Fish Taco Blog site, this is an example rel=”next” meta tag that Wordpress automatically generates:
<link rel='next' title='Chat Chew' href='http://www.fishtacoblog.com/new-york/chat-n-chew/' />
When viewing a post in the single.php template, Wordpress will output rel “next” and “prev” tags by default. Firefox then consumes this information and makes the decision to load the next page before you browse to it. The idea is that once you are browsing posts, you may be more likely to visit the next post in the sequence, possibly via the next post link that is present in many Wordpress themes, and it will now be locally cached by Firefox, speeding up page load time for when you actually do click on it.
Sure, this wouldn’t hurt most blogs – it’s a feature that enhances the user experience. However for high traffic blogs, and Wordpress sites that aren’t built on the traditional post concept, this feature is unnecessarily and possible harmful to performance.
To remove these tags from Wordpress site, add the following to your theme’s functions.php file:
For Wordpress versions 3.0 and above:
//remove auto loading rel=next post link in header remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
For older Wordpress versions:
//remove auto loading rel=next post link in header remove_action('wp_head', 'adjacent_posts_rel_link');
Here’s Mozilla’s background information on prefetching, and it should be noted that this currently only happens in Firefox, not Internet Explorer.