Add custom post type to RSS

Custom Post Types was one of the most hyped feature of WordPress 3.0. This feature alone expanded the horizon of WordPress usage as a Content Management System (CMS). Adding this PHP code to the functions.php of your wordpress theme will add custom post type of snippet to your RSS feed.

 

 

add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) {
if ( is_feed() )
$query->set( 'post_type', array( 'post', 'snippet' ) );
return $query;
}

Be Sociable, Share!

Leave a comment