我的页面结构如下:
执行活动年度会议网络研讨会我还有一个名为“活动”的自定义帖子类型。我已经设置了帖子类型,这样我就可以获得我想要的单个事件的permalink结构:
http://www.mysite.com/executive-events/name-of-single-event (single-post-type)
然而,当我去
http://www.mysite.com/executive-events/annual-conferences (page)
我有一个404。我已经刷新了permalink结构。似乎CPT的重写正在影响子页面的永久链接。有什么办法吗?
以下是自定义post类型“事件”的设置:
add_action(\'init\', \'cptui_register_my_cpt_event\');
function cptui_register_my_cpt_event() {
register_post_type(\'event\', array(
\'label\' => \'Events\',
\'description\' => \'\',
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'capability_type\' => \'post\',
\'map_meta_cap\' => true,
\'hierarchical\' => false,
\'rewrite\' => array(\'slug\' => \'executive-events\', \'with_front\' => 1),
\'query_var\' => true,
\'supports\' => array(\'title\',\'editor\',\'excerpt\',\'trackbacks\',\'custom- fields\',\'revisions\',\'thumbnail\',\'author\',\'page-attributes\',\'post-formats\'),
\'taxonomies\' => array(\'event-type\'),
\'labels\' => array (
\'name\' => \'Events\',
\'singular_name\' => \'Event\',
\'menu_name\' => \'Events\',
\'add_new\' => \'Add Event\',
\'add_new_item\' => \'Add New Event\',
\'edit\' => \'Edit\',
\'edit_item\' => \'Edit Event\',
\'new_item\' => \'New Event\',
\'view\' => \'View Event\',
\'view_item\' => \'View Event\',
\'search_items\' => \'Search Events\',
\'not_found\' => \'No Events Found\',
\'not_found_in_trash\' => \'No Events Found in Trash\',
\'parent\' => \'Parent Event\',
)
) ); }
谢谢!
编辑:如果我将permalink结构更改为默认值,我可以获得所需的效果,但当我将结构切换为“post name”时,会遇到问题。