Php Wordpress重命名自定义帖子类型
我正在开发Wordpress数据库模型,在该模型中,我在下面的布局中添加了许多带有分类法的自定义文章类型Php Wordpress重命名自定义帖子类型,php,mysql,wordpress,Php,Mysql,Wordpress,我正在开发Wordpress数据库模型,在该模型中,我在下面的布局中添加了许多带有分类法的自定义文章类型 function my_custom_settings(){ register_post_type( 'my_custom_post_type',array( 'labels' => array( 'name' => __( 'My Custom Post Type' ), 'singular_name' =>
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>';
UPDATE`wp\u posts`SET`post\u type`='',其中`post\u type`='';
这是什么意思
UPDATE `wp_posts` SET `post_type` = '<new post type name>' WHERE `post_type` = '<old post type name>';
UPDATE`wp\u posts`SET`post\u type`='',其中`post\u type`='';