Php 无法重命名自定义post类型的slug
我一辈子都不能改变我的自定义帖子类型。我尝试过刷新重写并重新保存永久链接。但它仍然显示了老鼻涕虫 My functions.phpPhp 无法重命名自定义post类型的slug,php,wordpress,custom-post-type,slug,Php,Wordpress,Custom Post Type,Slug,我一辈子都不能改变我的自定义帖子类型。我尝试过刷新重写并重新保存永久链接。但它仍然显示了老鼻涕虫 My functions.php register_post_type( 'roofers-peakdistrict', array( 'labels' => array( 'name' => __( 'Peak District' ), 'singular_name' => __( 'Roofers Peak
register_post_type( 'roofers-peakdistrict',
array(
'labels' => array(
'name' => __( 'Peak District' ),
'singular_name' => __( 'Roofers Peak District' ),
'add_new' => 'Add New Peak District Page',
'add_new_item' => 'Add New Peak District Page',
'edit' => 'Edit Peak District Page',
'edit_item' => 'Edit Peak District Page',
'new_item' => 'New Peak District Page',
'view' => 'View Peak District Page',
'view_item' => 'View Peak District Page',
'search_items' => 'Search Peak District Pages',
'not_found' => 'No Peak District Pages found',
'has_archive' => true,
'slug' => 'roofers-peak-district'
'hierarchical' => true,
'not_found_in_trash' => 'No Peak District Pages found in Trash',
'parent' => 'Parent Peak District Page', ),
'public' => true,
'supports' => array(
'title',
'editor',
'thumbnail'
),
'taxonomies' => array('category'),
)
);
我的帖子出来的时候就像
我需要将其更改为您使用了错误的数组 用这个代替
register_post_type( 'roofers-peakdistrict',
array(
'labels' => array(
'name' => __( 'Peak District' ),
'singular_name' => __( 'Roofers Peak District' ),
'add_new' => 'Add New Peak District Page',
'add_new_item' => 'Add New Peak District Page',
'edit' => 'Edit Peak District Page',
'edit_item' => 'Edit Peak District Page',
'new_item' => 'New Peak District Page',
'view' => 'View Peak District Page',
'view_item' => 'View Peak District Page',
'search_items' => 'Search Peak District Pages',
'not_found' => 'No Peak District Pages found',
),
'has_archive' => true,
'rewrite' => array(
'slug'=>'roofers-peak-district'
),
'hierarchical' => true,
'not_found_in_trash' => 'No Peak District Pages found in Trash',
'parent' => 'Parent Peak District Page',
'public' => true,
'supports' => array(
'title',
'editor',
'thumbnail'
),
'taxonomies' => array('category'),
)
))
更多详细信息和示例请参见