admin管理员组文章数量:1394194
I have an existing WP installation with 300 Pages, hierarchically structured. Editors intend to create around 2000 of them. Over time it becomes hard to find a particular page with the wordpress search function in the admin panel and it is hard to select a parent since there are many items in the dropdown.
I want to introduce CPTs to make the pages easier to manage.
What is the correct way to do this?
What I have tried:
I installed the Post Type Switcher plugin. Whenever I convert a page to CPT & click "save", Wordpress is appending a number in the slug, as if there was a duplicate. For example,
/holiday/usa/
becomes/holiday/usa-2/
. Refreshing the permalink structure didn't help.I tried manually converting the post_type with SQL. Still the same problem, permalinks get a number at the end.
How my CPT code looks like:
$args = array(
'show_in_rest' => true,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'menu_position' => 4,
'hierarchical' => true,
'has_archive' => false,
'query_var' => 'holiday',
'map_meta_cap' => true,
'rewrite' => array(
'slug' => 'holiday',
'with_front' => true,
'pages' => true,
'feeds' => true,
'ep_mask' => EP_PERMALINK
),
'supports' => array(
'title',
'editor',
'excerpt',
'author',
'thumbnail',
'revisions',
'page-attributes'
)
);
register_post_type(
'holiday',
$args
);
本文标签:
版权声明:本文标题:How to convert hierarchical Pages to hierarchical Custom Post Types? Slugs get a number as if they were duplicates 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744775167a2624581.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论