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.

When using w3.org's validation tool Unicorn I get the following error/warning:

URI: http://energyshop.se/hem/feed/ This feed does not validate.

After looking into my source its there crystal clear in the <head>: <link rel="alternate" type="application/rss+xml" title="energyshop.se &raquo; Hem kommentarsflöde" href="http://energyshop.se/hem/feed/" />

Now, how do I remove this feed since I dont use it?

Thanks in advance!

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

If we look at the file

/wp-includes/default-filters.php

we can find these two lines in there

add_action( 'wp_head',             'feed_links',                      2     );
add_action( 'wp_head',             'feed_links_extra',                3     );

so if we want to remove these actions, we can do it with these two lines in functions.php:

remove_action('wp_head','feed_links',2);
remove_action('wp_head','feed_links_extra',3);

So the feed links will be removed from the <head> tag.

ps: In this file you will also find:

add_action( 'do_feed_rdf',                'do_feed_rdf',                             10, 1 );
add_action( 'do_feed_rss',                'do_feed_rss',                             10, 1 );
add_action( 'do_feed_rss2',               'do_feed_rss2',                            10, 1 );
add_action( 'do_feed_atom',               'do_feed_atom',                            10, 1 );

If you want to disable the feeds, you can remove these hooks in a similar way with:

remove_action( 'do_feed_rdf', 'do_feed_rdf', 10, 1 );
remove_action( 'do_feed_rss', 'do_feed_rss', 10, 1 );
remove_action( 'do_feed_rss2', 'do_feed_rss2', 10, 1 );
remove_action( 'do_feed_atom', 'do_feed_atom', 10, 1 );

but then you will get this message when you visit the feed links

enter image description here

You might consider making url rewrites for the feed links or make a custom feed template, to get rid of this message.

share|improve this answer
    
Does the links has to be there because of how Wordpress is structured? And if I were to use remove_action('wp_head','feed_links',2); remove_action('wp_head','feed_links_extra',3); that would probably solve it but does that solution also generate that error because its not according to the template anymore? And if so, the best way would be to redirect it to just energyshop.se instead and keep it in the background without any real function? –  Emanuel Olsson Mar 7 '13 at 4:04
    
Your feed does not validate because the <lastBuildDate></lastBuildDate> is empty. You can remove the feed from the <head> tag and then you can check this to fix the empty lastBuildDate: wordpress.stackexchange.com/questions/8310/… –  birgire Mar 7 '13 at 10:37
    
I tried it and it works pretty good! Now on the Unicorn test I dont get a red warning kind of message anymore, but instead a blue Information warning: "It looks like this is a web page, not a feed. I looked for a feed associated with this page, but couldn't find one. Please enter the address of your feed to validate." Since it isnt really an error I could just ignore it, but are there a way to get rid of this one? I know it doesnt change much but I like to get to know how to fix these kind of things for the future.I used the remove_action and the fix from the link you gave into functions.php –  Emanuel Olsson Mar 7 '13 at 16:58
    
great, maybe you can just fix the empty lastBuildDate and leave the feed link in the header tag, if you don't want this w3 notice. A missing feed link should not change if your site is valid or not. –  birgire Mar 8 '13 at 12:01
add comment

The third params are also required, without them it didn't work for me

remove_action('wp_head','feed_links',2);
remove_action('wp_head','feed_links_extra',3);
share|improve this answer
add comment

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.