在不更改网址的情况下将帖子更改为“自定义帖子类型”

问题描述:

此问题之前已被询问,但我无法找到适合自己情况的答案。在不更改网址的情况下将帖子更改为“自定义帖子类型”

我有一些现有的职位需要更改为新的彩管。 当我更改为新的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); 

我使用一个整洁的插件Post Type Switcher

什么这个插件会做的是任何类型后切换到任何类型后用秒,我认为你可以随时使用这个插件,并删除这个插件..试试看

+0

它改变了帖子的网址 –