Custom Post type feed url showing the main feed's content.
Details: i have some custom post type on my site. I added them to main feed using this snippet
function mycustomfeed_cpt_feed( $query ) {
// Add to my custom-type post type
$types = array('post','blood-blog');
if ( $query->is_feed() )
$query->set( 'post_type', $types );
return $query;
}
add_filter( 'pre_get_posts', 'mycustomfeed_cpt_feed' );
Here is how I registered the post type
/*Register Blood Blog*/
function mcp_blood_blog() {
$labels = array(
'name' => _x( 'Blood Blog', 'post type general name' ),
'singular_name' => _x( 'Blood Blog', 'post type singular name' ),
'add_new' => _x( 'Add New', 'Blood Blog' ),
'add_new_item' => __( 'Add New Blog' ),
'edit_item' => __( 'Edit' ),
'new_item' => __( 'New Blood Blog' ),
'all_items' => __( 'Blood Blog' ),
'view_item' => __( 'View Blog' ),
'search_items' => __( 'Search Blog' ),
'not_found' => __( 'No Blog Found' ),
'not_found_in_trash' => __( 'No Blog Found Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Blood Blog'
);
$args = array(
'labels' => $labels,
'description' => 'Insert A Blood Blog',
'public' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-heart',
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments', 'author' ),
'has_archive' => true,
'hierarchical' => false,
'rewrite' => array('slug' => 'blood/blog','with_front' => true,'feeds' => true,),
'query_var' => true,
'publicly_queryable' => true,
'public' => true,
'show_in_admin_bar' => true,
'show_in_nav_menus' => false,
'capability_type' => 'post',
'_edit_link' => 'post.php?post=%d' ,
);
register_post_type( 'blood-blog', $args );
}
add_action( 'init', 'mcp_blood_blog' );
/*End Blood Blog*/
The problem is when i try to get the feed from custom post type like this one:
http://www.mediwaretesting.com/blood/blog/feed/
it returns the main feed content that already in
http://www.mediwaretesting.com/feed/
note: "blood/blog" in post type slug.