2017-09-05 27 views
0

此問題之前已被詢問,但我無法找到適合自己情況的答案。在不更改網址的情況下將帖子更改爲「自定義帖子類型」

我有一些現有的職位需要更改爲新的彩管。 當我更改爲新的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); 

回答

0

我使用一個整潔的插件Post Type Switcher

什麼這個插件會做的是任何類型後切換到任何類型後用秒,我認爲你可以隨時使用這個插件,並刪除這個插件..試試看

+0

它改變了帖子的網址 –

相關問題