繁体   English   中英

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

[英]Page not found on blog level 2 after registering taxonomy in WordPress

我有一个名为Resources的自定义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。

当我单击博客文章时,URL是正确的(即/resources/test-post ),因此不确定为什么会生成404吗? 我的猜测是与分类法有关吗?

其他资讯:

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

请刷新永久链接转到设置->永久链接->更改为帖子ID

并保存,然后再次将其更改为您喜欢的内容,然后再次保存。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM