显示主提要内容的自定义帖子类型提要url。
详细信息:我的网站上有一些自定义帖子类型。我使用这个片段将它们添加到主提要
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\' );
下面是我注册帖子类型的方式
/*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*/
问题是,当我尝试从如下自定义帖子类型获取提要时:
http://www.mediwaretesting.com/blood/blog/feed/
它返回已在中的主提要内容
http://www.mediwaretesting.com/feed/
注:post type slug中的“blood/blog”。