Not many people realize the power that WordPress gives them by making feeds for everything on the site. If you register a custom post type it gets a feed by default, so for my new WordPress Plugin Review section, which is built on a custom post type for plugin reviews, there’s a custom feed here:
http://yoast.com/wp-plugin-review/feed/
That feed is actually a valid “sitemap” for Google Webmaster Tools as well, so you can just submit it there, as you can see here:

Custom Post Type feeds in Google Webmaster Tools
If you submit them there, Google will regularly poll them which will make it easier for you to get your custom post types indexed!
If you want to add your custom post type feed to the head section of your page, use the following code, of course adapting it for your own post type:
function yst_add_feed() {
if ( is_post_type_archive( array('plugin_review') )
|| is_singular( 'plugin_review' ) )
{
$feed = get_post_type_archive_feed_link( 'plugin_review' );
echo '<link rel="alternate" type="application/rss+xml"
title="Plugin Reviews by Yoast RSS Feed"
href="'.$feed.'" />';
}
}
add_action( 'wp_head', 'yst_add_feed' );



add_feed() is already a defined function in WP core… /wp-includes/rewrite.php
Probably should use a different function name.
Also, it looks like you forgot to add an action hook to call your new function :).
Lew
hehe ugh this is actually copied directly from my plugin review plugin’s class :) will change :)
fixed :)
Wow, I’m actually surprised that WordPress does do this automatically for public post types. Thanks for sharing the fix! FWIW, the conditional could be simplified by using is_singular( ‘plugin_review’ ).
fair enough, updated it to reflect that :)
Do you know the name of the bot Google use to crawl sitemaps submitted in this manner?
Like everyone else, I redirect everything but the Feedburner bot, it would be handy to add Google’s sitemap bot as an exception.
Cheers,
Peter
I’ve actually hacked around that quite a bit, and am not redirecting all feeds to FeedBurner, as the often used plugin does…
Great tip – thanks.
Noticed you have a video_sitemap feed as well (Generated by Yoast’s WordPress SEO plugin) — have you released that module yet?
No I haven’t, still coding away on it (it’s bloody hard to get right)
IMO – even you’re “not quite right” code is really good. I’m ready to beta test for you.
For my website… I have Feature Video, Video, News-Gossip, and Premium Videos…these a basically main categories I always create new post for. Are you saying I should have a sitemap for each categorie… instead of using sitemap.xml.gz?
But they’re categories, not post types right? You could still throw them all into Google Webmaster Tools, it’d actually give you a good view of how certain sections of your site are being indexed.
I like the idea of getting a feed of the custom post type, but they don’t get in the same RSS stream as the regular post right? As far as I recall last time I tried I couldn’t get that to work.
I’ve actually just done it for my best practices custom post type, they now show up in my feed.This little snippet from @DeFries was quite helpful.
Sorry, what snippet from @DeFries was that?
@thomas Clausen, Even i tried a lot but could not get it to work but still i love word press and its simply the best.
This is a great tip, something I didn’t really know was possible.
I am having trouble getting this to work though. If I use the do_action function call, it duplicates the wp_head stuff and places it above the DOCTYPE.
I can’t seem to find a working solution for this.
Thanks
Vayu
That’s actually because of a fault in that code, I’m sorry. Just changed it, it should be
add_action, notdo_action.Thanks Joost. Yes, I figured that out later on. :-)
What is required for WP to register an archive page for the CPT? When I test this:
is_post_type_archive( array('portfolio') )it tells me that there isn’t any archive page. When I registered my CPT I even used:
'has_archive' => true,Anyway, I know this might not be the right place for support, but I appreciate any tips on this. :-)
Vayu
This:
is_post_type_archive( array('portfolio') )will only return true on the archive page for that post type, so on example.com/portfolio/, if portfolio is also the slug you used to register the post type.
Great, thanks!
Vayu
This is a great tip! Never even thought about it, but used it right away on a new site I’m building using CPT..
Thanks, Sander
Great Tip and thanks for sharing the information..
You could do the same by using the multisite option WP, but that is a lot of extra work and maybe the hardest way to get things sorted out. Cool tip Joost. tnx!
Hi,
Just wondering a little tangentially how one implements Yoast SEO for a custom post type? Some of my custom post types seem to work automatically with SEO, however, ones I have implemented myself show the Yoast SEO form, but nothing is saved when the custom post is saved. Just wondering what the problem might be.
Thanks a lot for all your wonderful plugins by the way!
Hi, I like the idea to use the feed as a sitemap.
Can this somehow work for images also.
Thanks!
Hi, nice text. Thanks!
This is awesome! I thought about trying this a while back, but thought I was nuts and it wouldn’t work.
Thanks for the post, I will be putting it to good use!
but what’s the benefit of having multiple feeds for the same data? or we can have different feeds for different data like video sitemap etc?
Cool stuffs for WordPress SEO ,Feed is very important for SEO
Very interesting indeed, thanks. Now, in your Google Webmaster Tools picture you have a type called images. Can wordpress also created a feed or sitemape for images only which I can then submit to Google Webmaster Tools? Thanks