我正在开发一个Wordpress数据库模型,在该模型中,我添加了许多具有以下布局中的分类法的自定义帖子类型
function my_custom_settings(){
register_post_type( 'my_custom_post_type',array(
'labels' => array(
'name' => __( 'My Custom Post Type' ),
'singular_name' => __('My Custom Post Type')
),
'public' => true,
'menu_position' => 6,
'rewrite' => array(
'slug' => 'my-custom-post-type',
'with_front' => true,
)));
register_taxonomy('my_custom_taxonomy','my_custom_post_type',array(
'hierarchical' => true,
'label' => 'My Custom Taxonomy',
'query_var' => true,
'rewrite' => array('slug' => 'my-custom-taxonomy')
));
}
add_action('init','my_custom_settings');
我想知道是否可以更改实际注册帖子类型的名称空间(例如my_custom_post_type
到my_other_custom_post_type
),同时保持数据库关系和帖子的完整性。我的问题是,许多帖子类型都有类似的名称空间,这越来越令人困惑,所以我想我需要知道要更改的特定数据库字段,并想知道是否有人知道位置和/或是否有更容易的方法来重命名自定义帖子类型。提前感谢!
这是什么?
UPDATE `wp_posts` SET `post_type` = '<new post type name>' WHERE `post_type` = '<old post type name>';