[wp-hackers] Adding custom post types to feed breaks term feed

Simon Blackbourn piemanek at gmail.com
Wed May 11 19:30:01 UTC 2011


I need to add custom post types to the main feed, so I've used the following
piece of code, which is fairly widely quoted around the net as the way to
achive this.


add_filter( 'request', array( $this, 'feed_request' ) );

function feed_request( $qv ) {

    if ( isset( $qv['feed'] ) && !isset( $qv['post_type'] ) )
        $qv['post_type'] = array( 'post-type-1', 'post-type-2' );

    return $qv;

}


However individual term feeds, i.e. http://example.com/taxonomy/term/feed,
then show as having no items.

Is there a correct way to add custom post types to the main feed that
doesn't break these other feeds?

Thanks
Simon


More information about the wp-hackers mailing list