Wordpress重命名自定义帖子类型

时间:2013-02-17 04:08:51

标签: 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' => __('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),同时保持数据库关系和帖子的完整性。我的问题是很多帖子类型都有类似的命名空间,这让人感到困惑,所以我想我需要知道要更改的特定数据库字段,并且想知道是否有人知道位置和/或是否有重命名的缓动方法自定义帖子类型。提前谢谢!

1 个答案:

答案 0 :(得分:3)

这些方面的东西?

UPDATE  `wp_posts` SET  `post_type` =  '<new post type name>' WHERE  `post_type` = '<old post type name>';