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);
它改變了帖子的網址 –