试图找到一个帖子出现在http://beernews.org/supporter/rare-beer-club/ 但我得到的是404。页面外观的示例如下:http://beernews.org/brewery/5-rabbit-brewery/. 当我进行搜索时,它会在结果中显示为摘录。只是无法获得模板的单个支持者。php由于某种原因触发。我已经设置了与其他所有帖子类型和分类法完全相同的帖子类型(和相应的分类法)。
我已刷新缓存和CDN。
我没有用于此的实时服务器测试环境,但相同的代码可以在localhost上运行。因为它的流量很大,所以我不愿意打开前端显示的调试功能。
在函数中注册post类型代码。php
$labels = array(
\'name\' => _x(\'Supporters\', \'post type general name\'),
\'singular_name\' => _x(\'Supporter\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'supporter\'),
\'add_new_item\' => __(\'Add New Supporter\'),
\'edit_item\' => __(\'Edit Supporter\'),
\'new_item\' => __(\'New Supporter\'),
\'all_items\' => __(\'All Supporters\'),
\'view_item\' => __(\'View Supporter\'),
\'search_items\' => __(\'Search Supporters\'),
\'not_found\' => __(\'No supporters found\'),
\'not_found_in_trash\' => __(\'No supporters found in Trash\'),
\'parent_item_colon\' => \'\',
\'menu_name\' => \'Supporters\'
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'capability_type\' => \'post\',
\'has_archive\' => true,
\'hierarchical\' => true,
\'menu_position\' => null,
\'taxonomies\' => array (\'beer\',\'category\'),
\'supports\' => array(\'title\',\'editor\',\'author\',\'thumbnail\',\'excerpt\',\'trackbacks\',\'custom-fields\',\'page-attributes\',\'revisions\',\'comments\',\'post-formats\')
);
register_post_type(\'supporter\',$args);
在函数中注册分类代码。php
// Add new taxonomy, make it hierarchical (like categories)
$labels = array(
\'name\' => _x( \'Supporters\', \'taxonomy general name\' ),
\'singular_name\' => _x( \'Supporter\', \'taxonomy singular name\' ),
\'search_items\' => __( \'Search Supporters\' ),
\'all_items\' => __( \'All Supporters\' ),
\'parent_item\' => __( \'Parent Supporter\' ),
\'parent_item_colon\' => __( \'Parent Supporter:\' ),
\'edit_item\' => __( \'Edit Supporter\' ),
\'update_item\' => __( \'Update Supporter\' ),
\'add_new_item\' => __( \'Add New Supporter\' ),
\'new_item_name\' => __( \'New Supporter Name\' )
);
register_taxonomy(\'supporter\',array(\'beer\',\'post\'),
array(
\'hierarchical\' => true,
\'labels\' => $labels,
\'show_ui\' => true,
\'query_var\' => true,
\'rewrite\' => array( \'slug\' => \'supporters-bp\' )
));