如何解决父页面与 Post_Type 具有相同固定链接的子页面
我需要构建与 post_type 具有相同 URL 的子页面。
即;我的 post_type 是 work
- 我可以在
/work
发布主页,而且效果很好。 - 我在
/work/thing-1
下发布的帖子 -
/work/page
下的页面不起作用,因为它正在那里寻找post_type
的页面。
当 post_type
与同一个 slug 存在时,如何让子页面工作?如果我将 slug 更改为 works
一切正常。但客户希望 post_type
具有与页面相同的 slug 结构。
我的 post_type
是:
"name" => __( "Portfolios","clients-child" ),"singular_name" => __( "Portfolio",];
$args = [
"label" => __( "Portfolios","labels" => $labels,"description" => "","public" => true,"publicly_queryable" => true,"show_ui" => true,"show_in_rest" => true,"rest_base" => "","rest_controller_class" => "WP_REST_Posts_Controller","has_archive" => false,"show_in_menu" => true,"show_in_nav_menus" => true,"delete_with_user" => false,"exclude_from_search" => false,"capability_type" => "post","map_meta_cap" => true,"hierarchical" => false,"rewrite" => [ "slug" => "work","with_front" => false,"with_archive" => false ],"query_var" => true,"supports" => [ "title","editor","thumbnail" ],];
register_post_type( "portfolio",$args );
}
add_action( 'init','cptui_register_my_cpts_portfolio' );
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。