WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

By default WP seems to display all posts of all types in the main RSS feed. You have to add a post_type query variable to show post of a certain type...

So how can I turn this:





And if possible rewrite http://site.com/feed/ to http://site.com/feed/blog/, which should display only normal posts...

share|improve this question
up vote 3 down vote accepted

If you set 'has_archive' => TRUE in register_post_type() the post type will have its own feed on /books/feed/ and its items are not included in the main feed.

Example plugin

Plugin Name: WPSE13006 feed for CPT demo
! defined( 'ABSPATH' ) and exit;

add_action( 'init', 'wpse13006_register' );

// Call wp-admin/options-permalink.php once after activation to make permalinks work
function wpse13006_register()
    ,   array (
            'has_archive'         => TRUE
        ,   'label'               => 'wpse13006'
        ,   'public'              => TRUE
        ,   'publicly_queryable'  => TRUE
        ,   'query_var'           => 'wpse13006'
        ,   'rewrite'             => array ( 'slug' => 'wpse13006' )
        ,   'show_ui'             => TRUE
        ,   'show_in_menu'        => TRUE
        ,   'supports'            => array ( 'title', 'editor' )

Create one post, publish and view it. If you go up one level to /wpse13006/ now, you’ll find the feed at /wpse13006/feed/. The post will not show up in the main feed.

share|improve this answer
thanks, I didn't know about these URLs even though I had has_archive on (but custom post types are still included in the main feed). Do you know if there's a function that returns the rss URL for each post type, or you need to build it manually? – onetrickpony Mar 25 '11 at 11:47
@One Trick Pony Strange, the CPTs are never in my main feed. get_post_type_archive_feed_link() should return the feed URI, but it returned always FALSE in my tests. – toscho Mar 26 '11 at 5:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.