【发布时间】:2017-09-05 14:15:41
【问题描述】:
以前有人问过这个问题,但我找不到适合我情况的答案。
我有一些现有的帖子需要更改为新的 CPT 。 当我更改为新的 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 );
【问题讨论】:
标签: wordpress custom-post-type