Tutorial: How to Remove link rel=’prev’ and link rel=’next’ from WordPress Head
How to Remove link rel=’prev’ and link rel=’next’ from WordPress Head (in WP 3.0+)
WordPress, in its default state, prints a lot of excess code to the head section of webpages. One element that always annoyed me were two entries that always appeared:
<link rel='prev' title='' href='' /> <link rel='next' title='' href='' />
These entries are recommended for web usability for disabled persons–consider that before removing them. We were looking for a way to lean up our pages, though, so we thought we’d like to remove these entries. There are some outdated instructions in WP forums that will not work in WP 3.0; we tried several approaches, but nothing worked.
In your WordPress template, you’ll find your functions.php file. Open that file and enter the following line.
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
This “filter,” as it is called, will tell WordPress not to generate the link rel=’prev’ and link rel=’next’ lines in the WordPress head.
Just a note on why those outdated instructions wouldn’t work with WP 3.0. The filter we created instructs WP to turn off the action titled “adjacent_posts_rel_link_wp_head.” Our commands works in WP 3.0 and above because the former action prior to 3.0 was titled “adjacent_posts_rel_link.”