What are the advantages and disadvantages of using add_theme_support('automatic-feed-links')
in my functions.php
file?
Leave a Reply
You must be logged in to post a comment.
What are the advantages and disadvantages of using add_theme_support('automatic-feed-links')
in my functions.php
file?
You must be logged in to post a comment.
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.
Hopefully someone will expand on this a bit more, but here goes:
add_theme_support('automatic-feed-links')
in yourfunctions.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
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.