【发布时间】:2016-01-06 00:21:29
【问题描述】:
我有 Custmom 帖子类型 并且有一个重写 slug,它运行良好,直到我将分层设置为 true。
分层在 wp-admin 中运行良好,但是当我在前端导航时,CPT 添加的项目转到 404 页面。
请注意,flush_rewrite_rules() 已集成,并且我多次尝试使用 wordpress 4.3.1 在设置中重新提交永久链接。
$arg = [
'public' => true,
'show_ui' => true,
'_builtin' => false,
'_edit_link' => 'post.php?post=%d',
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => ['slug' => 'book', 'page-attributes'],
'query_var' => 'book',
'supports' => ['title', 'editor', 'thumbnail'],
'menu_position' => 5,
'menu_icon'=> 'dashicons-testimonial'
];
当我设置'hierarchical' => true, 时,它会进入 404 页面。
【问题讨论】:
标签: php wordpress custom-post-type permalinks hierarchical