For ages, theme authors have been adding code like this to their theme’s header.php files:

<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />

No need for that any more. Remove that stuff, make sure you’ve got the wp_head() call in the header (like you should anyway), then add this to the theme’s functions.php file instead:

add_theme_support( 'automatic-feed-links' );

This automatically adds the relevant feed links everywhere on the whole site. Standard feed, comments links, category and tag archives, everything as it should be.

Shortlink:

17 Comments

  1. thx, great tip, been struggling with a lot of plugins to achieve this 🙂

  2. Automatic feed links have been around since WP 2.8.

    Only the `add_theme_support( ‘automatic-feed-links’ );` bit is new.

  3. woowww.. simple tags thanks for share

  4. I needed to know about this,
    thanks for posting AND making it findable in one page search!

  5. […] the <head> section of their pages. Now, WordPress 3.0 does it automatically for us. Check out Otto’s post for more […]

  6. […] the <head> section of their pages. Now, WordPress 3.0 does it automatically for us. Check out Otto’s post for more […]

  7. […] it opens up a wide variety of possibilities for customizing the background of your WordPress Theme.WordPress 3.0 Theme Tip: Feed Links – Otto on WordPress – Otto brings up another tip for WordPress Theme authors on how to add automatic feed links […]

  8. […] Otto on WordPress – add theme support automatic feed links […]

  9. I have added the code to functions.php and the header is correct, but the feeds do not work. Anything else I might try? This is a wp ecommerce site. Thanks for the tips.

  10. I’m using this to generate automatic feed links, however I would like to disable the Global Comments Feed from appearing on EVERY page. Any suggestions?

  11. Hi,

    I wonder if this automatic header feed link functionality can be used to display only the relevant feed links on each page as well?

    So I don’t want the same two feed links (all comments/all posts) on every page but would rather prefer to have an author’s feed link, a category feed link etc. if browsing author oder category pages — just like these automatically added feed links in the header.

    Is there something out there like this? A widget which I could simply add to my sidebar, always showing the relevant feed links for that particular page?

    Greets

  12. Is there any easy way to display the feed links? Like for the entire blog, categories, comments and article?

  13. I have added the code to functions.php and the header is correct, but the feeds do not work. Anything else I might try? This is a wp ecommerce site. Thanks for the tips.

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Need to post PHP code? Wrap it in [php] and [/php] tags.