Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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' />
share|improve this question
    
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. –  chrisguitarguy Sep 20 '11 at 16:47
    
Thanks Christopher, good advice. –  N2Mystic Sep 22 '11 at 12:23

4 Answers 4

up vote 0 down vote accepted

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


EDIT: As this A has been downvoted by someone who seems to not know anything about it, here are some additions:

share|improve this answer
2  
+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 '11 at 12:41
1  
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. –  chrisguitarguy Sep 22 '11 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 '11 at 13:12

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

share|improve this answer

Add these to your list:

<?php
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.

share|improve this answer

Had same problem but it was involving Yoast SEO plugin leaving rel="next" in header, if you have similar experience here is code, just add to functions.php

function wpseo_disable_rel_next_home( $link ) {
  if ( is_home() ) {
    return false;
  }
}
add_filter( 'wpseo_next_rel_link', 'wpseo_disable_rel_next_home' );

here is plugin documentation for other functions too. http://yoast.com/wordpress/seo/api/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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