首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在WordPress中注册分类法后,博客级别2中找不到的页面

在WordPress中注册分类法后,博客级别2中找不到的页面
EN

Stack Overflow用户
提问于 2019-08-28 12:44:59
回答 1查看 38关注 0票数 0

我有一个名为“参考资料”的自定义post type,它被添加如下:

代码语言:javascript
复制
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 )
        )
    )
);

并且像这样注册了这个分类:

代码语言:javascript
复制
register_taxonomy(  
    'resource', 
    'resources', 
    array(  
        'hierarchical' => false,  
    query_var' => true,
  )  
); 

在URL /resources上,级别1模板加载得很好。但是,当从这个页面中选择一篇博客文章时,它会得到404。

当我点击博客帖子时,网址是正确的(即/resources/test-post),所以不确定它为什么会导致404?我猜这跟分类学有关吧?

其他信息:

  • 第1级博客模板使用:archive-resources.php
  • 第2级博客模板使用:single-resources.php
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-08-28 12:54:12

请刷新permalinks,转到设置,-> permalinks,->,改为post id

然后再把它修改成你喜欢的东西,然后再保存一次。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57692755

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档