Skip to content

Instantly share code, notes, and snippets.

@tanmay27vats
Created April 24, 2017 08:40
Show Gist options
  • Save tanmay27vats/bec4f4bde8f8a493a6fa97c16320af4a to your computer and use it in GitHub Desktop.
Save tanmay27vats/bec4f4bde8f8a493a6fa97c16320af4a to your computer and use it in GitHub Desktop.
Renaming Custom Post Types and Taxonomies Through MySQL Query - Wordpress
SQL query for renaming the posts:
UPDATE `wp_posts` SET `post_type` = '<new post type name>' WHERE `post_type` = '<old post type name>';
SQL query for renaming taxonomy:
UPDATE `wp_term_taxonomy` SET `taxonomy` = '<new taxonomy name>' WHERE `taxonomy` = '<old taxonomy name>';
# That should take care of all of the database areas. Just remember to match the new names in the code where the post types or taxonomies are registered. As far as I know, this is not handled in any plugins yet.
@raksbisht
Copy link

Thanks, life saving ;)

@aloktomar
Copy link

it's really helpful for me thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment