7

What are the advantages and disadvantages of using add_theme_support('automatic-feed-links') in my functions.php file?

2 Answers 2

11

A long time ago WordPress did not put feed links into the head element automatically. Theme or plugin authors had to do that.

In 2009 automatic_feed_links() was introduced, a function that should be used in themes or plugins to let WordPress do the hard work.

One year later it was added to Twenty Ten, and it became a de facto standard.

Not much later add_theme_support() was implemented and the first function was deprecated in favor of this new super-function which is now part of the theme review guidelines.

But all this happens still to avoid conflicts with pre-2009 themes: WordPress does never create duplicate feed links, unless the author asks for that.

I have questioned this practice. This functionality is not about presentation, and old themes should not have such an impact on the current development. Chip Bennett brought the issue up in his latest discussion about the theme review guidelines.

I guess we can expect some progress here in the near future.

So the advantage is: you get feed links.
The disadvantage: you mix non-presentational functionality into the theme.

1
  • My understanding is you get feed links regardless of whether you provide a link in the <head>. example.com/feed will still show the site's feed if you don't provide the link in <head>. I think the advantage is more related to RSS readers being able to find the feed. Commented Apr 27, 2017 at 17:28
5

Hopefully someone will expand on this a bit more, but here goes:

add_theme_support('automatic-feed-links') in your functions.php file, adds code (<link rel="alternate"...) to the <head> of your pages which links to the relevant RSS feed for that pages content. This is generally preferred to add code like this in WordPress than to put it in manually. Having such a link provides an "alternate" format for the content on the page.

From: http://www.w3.org/QA/Tips/use-links

It gives the possibility to RSS Readers to find the Web site updates feed.

Googling about this myself, I share your frustration - it's difficult to find a good description of the pros/cons of including these links, and the relevant wordpress codex page is currently pretty weak.

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.