How to Make Your Feeds Auto-Discoverable in WordPress

One of the first things I discovered after installing WordPress and customizing my theme is that not all of the feeds were auto-discoverable by the browser. My first entry describes how to enable this feature using simple html pages, so I knew what needed to be done to enable this feature, but I didn’t know how to do this in WordPress. So here is what I learned. Oh, by the way, I’m using version 2.0.2 so I don’t know if this applies to previous versions or not.

  • The tags described below go in the header.php file included with your theme. Files that come with the WordPress installation do not need to be updated.
  • Most themes come with the standard RSS 2.0 and Atom feed tags already included in the header.php file, but you can check your file to see which ones are included and delete or add which ever feeds you like.
  • I quickly learned that WordPress, or the browser, or my theme (not sure exactly which) is very picky about spreading PHP code over more than one line. I kept getting a parse error until I put all the code on one line. After that, it worked perfect. Something to keep in mind…
  • WordPress comes with 5 built in feeds. Here are the tags you would add to your header.php file for each of them:

RSS 2.0


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

RSS 2.0 Comments

<link rel="alternate" 
type="application/rss+xml" 
title="RSS 2.0 Comments" href=
"<?php bloginfo('comments_rss2_url'); ?>" />

RSS .92

<link rel="alternate" 
type="text/xml" 
title="RSS .92" 
href="<?php bloginfo('rss_url'); ?>" 
/>

Atom

<link rel="alternate" 
type="application/atom+xml" 
title="Atom 0.3" 
href="<?php bloginfo('atom_url'); ?>" 
/>

RSS 1.0/RDF

<link rel="alternate" 
type="application/rss+xml" 
title="RSS 1.0/RDF" 
href="<?php bloginfo('rdf_url'); ?>" 
/>

(I’m not exactly sure what the type would be for RSS 1.0/RDF as I didn’t include it in mine)

Good luck!

Leave a Reply

You must be logged in to post a comment.