Programmatically Change post_type
Now that WordPress 3.0 is out, everyone is wanting to use Custom Post Types. But what if you have a load of posts that you want to convert to a new custom post type?
If Custom Post Types are new to you, I seriously recommend you check out Justin Tadlock’s article on them, as well as looking at all of Shibashake’s stuff.
This is a really simple tip, and is as follows:
UPDATE wp_posts SET post_type = REPLACE (post_type, 'post', 'custom_type');
This would update all posts with the post type ‘post’ to have the post type ‘custom_type’. Use with caution, and don’t forget to backup your DB before running the query.
This could even be made into a plugin to make it more manageable for a non-tech user.










2 Comments - Add Yours!
A plugin which allowed you to choose which posts to dynamically convert would be handy too.
Any ideas if such a thing exists now?
Hi Ryan, there’s a couple of options, if you want to convert posts one by one, try http://wordpress.org/extend/plugins/post-type-switcher/ or for converting multiple posts check out http://wordpress.org/extend/plugins/convert-post-types/.