admin管理员组文章数量:1122832
The problem is complex. When ACF and YAST SEO are activated, and custom taxonomy does not have a slug, the code is below. However, regular pages display a 404 error. I tested it on pure WordPress. ACF purchased, latest version.
register_taxonomy(
'course_cats',
'course',
array(
'hierarchical' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'labels' =>array(),
'query_var' => true,
'rewrite' => array( 'slug' => '/', 'with_front' => false),
'show_in_rest' => true,
)
);
The problem is complex. When ACF and YAST SEO are activated, and custom taxonomy does not have a slug, the code is below. However, regular pages display a 404 error. I tested it on pure WordPress. ACF purchased, latest version.
register_taxonomy(
'course_cats',
'course',
array(
'hierarchical' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'labels' =>array(),
'query_var' => true,
'rewrite' => array( 'slug' => '/', 'with_front' => false),
'show_in_rest' => true,
)
);
Share
Improve this question
edited Jun 1, 2024 at 17:54
Сергей Константинов
asked Jun 1, 2024 at 17:53
Сергей КонстантиновСергей Константинов
32 bronze badges
1 Answer
Reset to default 0The problem is your slug
parameter, it can't just be /
- you need to have something that identifies the URL as being this taxonomy. It defaults to the taxonomy key which in this case would be course_cat
but in the interest of human-readable URLS you could do this instead:
'rewrite' => array( 'slug' => 'course-category', 'with_front' => false )
本文标签: url rewritingHow to customize the url structure
版权声明:本文标题:url rewriting - How to customize the url structure? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305213a1932509.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论