我不能为我的生活改变我的自定义帖子类型的slu ..我已经尝试刷新重写并重新保存我的永久链接。但它仍然显示了旧的slu ..
我的functions.php
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'),
)
);
一样
答案 0 :(得分:2)
您使用的是错误的数组 请改用
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'),
)
);
更多细节&例子见 http://codex.wordpress.org/Function_Reference/register_post_type