I started developing a site with over a dozen custom post types. I’d like to rename a few of them, not just the display value, but the actual custom post type name. I’m worried however that by just running a SQL update query that I’ll miss some places where I need to change things or overwrite part of serialized data. I have already inputed over 3,000 items, so I can’t just restart with a clean database.
What would be the best way to rename a custom post type?
How about renaming a taxonomy?
SQL query for renaming the posts:
SQL query for renaming taxonomy:
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.
Hi @Derek Perkins:
In general @John P Bloch’s answer is spot on but with a caveat. Plugins and even custom themes can and may store post type information and thus in order to be sure that you won’t corrupt your data you need to ensure your plugins and themes don’t store post types or if they do that you update their data as well.
Can you tell us what plugins you are using?
If you don’t want to have to perform the SQL queries yourself manual there are a couple of plugins you can use:
I’ve successfully used Convert Post Types to mass change posts.
For converting invididual posts then Post Type Switcher is a better option.