我有一个名为“参考资料”的自定义post type,它被添加如下:
register_post_type(
'resources',
tp_build_post_args(
'resources', 'Resource', 'Resources',
array(
'menu_icon' => 'dashicons-welcome-write-blog',
'menu_position' => 20,
'has_archive' => true,
'public' => true,
'supports' => array('editor', 'title','author','thumbnail', 'revisions'),
'taxonomies' => array('subject', 'type', 'sector')
//'rewrite' => array ( 'slug' => 'resources', 'with_front' => false )
)
)
);并且像这样注册了这个分类:
register_taxonomy(
'resource',
'resources',
array(
'hierarchical' => false,
query_var' => true,
)
); 在URL /resources上,级别1模板加载得很好。但是,当从这个页面中选择一篇博客文章时,它会得到404。
当我点击博客帖子时,网址是正确的(即/resources/test-post),所以不确定它为什么会导致404?我猜这跟分类学有关吧?
其他信息:
archive-resources.phpsingle-resources.php发布于 2019-08-28 12:54:12
请刷新permalinks,转到设置,-> permalinks,->,改为post id
然后再把它修改成你喜欢的东西,然后再保存一次。
https://stackoverflow.com/questions/57692755
复制相似问题