在不更改网址的情况下将帖子更改为“自定义帖子类型”
问题描述:
此问题之前已被询问,但我无法找到适合自己情况的答案。在不更改网址的情况下将帖子更改为“自定义帖子类型”
我有一些现有的职位需要更改为新的彩管。 当我更改为新的CPT时,网址也会更新。我怎样才能防止这个?
另外我也希望slug出现在我为CPT创建的任何新页面中。
$args = array(
'labels' => $labels,
'label' => 'Custom Page',
'description' => 'Custom Page',
'menu_icon' => 'dashicons-smartphone',
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array(
'slug' => 'custom',
'with_front' => false
),
'capability_type' => 'post',
'has_archive' => false,
'hierarchical' => true,
'menu_position' => 5,
'supports' => array('title', 'editor', 'excerpt', 'page-attributes'),
);
register_post_type('custom_page', $args);
它改变了帖子的网址 –