![](/img/trans.png)
[英]Remove custom postype base slug and prefix permalink with custom taxonomy + post title or just post title
[英]Permalink structure for custom post/custom taxonomy with page slug prefix
我有一个自定义帖子类型和自定义分类法:
register_post_type( 'faq',
array(
'labels' => array(
'name' => __( 'FAQ' ),
'singular_name' => __( 'FAQ-Eintrag' ),
'add_new' => __('Neuer FAQ-Eintrag')
),
'public' => true,
'query_var' => false,
'rewrite' => array('slug' => 'faq','with_front' => false),
'supports' => array(
'title', 'editor', 'thumbnail'
),
)
);
register_taxonomy(
'faq-kategorie', // internal name = machine-readable taxonomy name
'faq', // object type = post, page, link, or custom post-type
array(
'hierarchical' => true,
'label' => 'FAQ – Kategorie', // the human-readable taxonomy name
'query_var' => true, // enable taxonomy-specific querying
'rewrite' => array( 'slug' => 'faq-category' )
)
);
我有一个页面,其中显示了所有自定义常见问题解答帖子,此页面有slug / faq /
我的意图是使这种结构具有永久链接:
/ faq /-概述常见问题页面(带有模板的页面)
/ faq / slug-of-faq-kategorie / slug-of-faq-custom-post-常见问题解答帖子
/ faq / slug-of-faq-kategorie /-常见问题术语存档
当我为分类法设置'rewrite'=> array('slug'=>'faq')时,我得到404的分类法/发布
总是有此问题(因为页面的第一段是常见问题=帖子/分类法的相同段)。 有人能帮忙吗? 提前致谢
要将/faq/
作为概述页面,请执行以下操作:archive-faq.php
has_archive
,默认为false(请参阅docs ) 为确保您确实能够看到永久链接更改的结果,请单击wp-admin设置永久链接中的“ save permalinks
链接”以“刷新”缓存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.