I'm using these filters to clean the head of my theme:

remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'feed_links_extra', 3);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
remove_action('wp_head', 'parent_post_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
remove_action('wp_head', 'locale_stylesheet');
remove_action('wp_head', 'noindex');
remove_action('wp_head', 'wp_print_styles');
remove_action('wp_head', 'wp_print_head_scripts');

However, I can't seem to get rid of these:

<link rel='prev' title='Top Menu Item 1' href='http://localhost/test/test-prev.html' />
<link rel='next' title='Internal title test default title' href='http://localhost/test/text-next.html' />
<link rel='shortlink' href='http://localhost/test/?p=528' />
  • Outside the scope of your question, but I wouldn't remove wp_print_styles or wp_print_head_scripts. A lot of plugins are going to rely on those to enqueue styles and scripts. Your theme will probably be enqueuing its own styles and scripts as well. Sep 20, 2011 at 16:47

3 Answers 3


One shouldn't remove them. They are important for search engines like Google.

One can remove them like this:

remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');

Here are some additional explanations why they should not be removed and how this effects search engines:

In case one removes them, one should really add its own (in case one has changed their links and they are not pointing to the correct urls, that the pagination points to).

  • 4
    +1 for the link to pagination article from Google. However, WordPress puts pagination on the page regardless if the prev/next posts are related or not. WP should allow you to define a paginated series at the post/page level and only print the pagination links if that's present for the current page being viewed. This would meet the test and spirit of pagination as expressed in the google article and examples.
    – N2Mystic
    Sep 22, 2011 at 12:41
  • 3
    The trac ticket is talking about archives, not single posts, though Yoast suggests that the single implementation be changed to better reflect Google's stance. The next/prev would be important for archives and paginated articles, especially on sites that are extremely hard to crawl (eg. non-pretty permalinks). Finally, SEO is not about generalizations. If you remove the links and see your index counts going down, then we can talk about the negative side effects of removing the links. But I suspect on a crawlable site, with good permalinks and internal linking, they won't make a difference. Sep 22, 2011 at 13:05
  • +1 on both comments. Valid points. Anyway, I'd suggest to go with @ChristopherDavis comment: Don't remove them - watch their effect.
    – kaiser
    Sep 22, 2011 at 13:12

Add these to your list:

remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');

wp-includes/default-filters.php should be your first stop to check out what WordPress is using its own hook system for.

  • There is a ; missing from the second line.
    – alpipego
    Jul 28, 2015 at 11:07
  • true, but default-filters.php does nothing, the called functions are inside link-template.php and uses wp_get_shortlink( 0, 'query' ); and function wp_get_shortlink() has a circuit filter, 'pre_get_shortlink', and finally return apply_filters( 'get_shortlink', $shortlink that serves the url. Oct 24, 2017 at 3:05

I've been struggling with this for a while, too, and it appears you should remove action with exactly the same parameters it was added.

so for me the following like in functions.php did the job:

remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10,0);

I'm using WP 3.3.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.