DNExpert.com - domain name news & opinions!
Have domain industry news? Contact us!

Hello & welcome!

AlexKing Threads

How To Convert One Post Type To Another In WordPress

With WordPress 3.0 came the long awaited feature of custom post types which in many ways signaled the arrival of WordPress as a truly universal content management system. Where previously all content written in WordPress was either a post or a page, this new feature allowed content to be anything you like – recipes, inventory items, reviews, code snippets… you name it.

WordPress posts are stored in the wp_posts database table. There are 5 core WordPress post types: post, page, attachment, revision and nav_menu_item. With custom post types you can create unlimited other post types, all of which are also stored in the same wp_posts table.

While this ability to create custom post types finally allows webmasters to differentiate between types of content, what happens to content written pre WordPress 3.0? What if you run a cooking website that has been around for ages and all your recipes are written as WordPress posts? Or, what if you run a real-estate business website and all your listings are published as WordPress posts? Although having custom post types for each of these content types would be neat, can you convert posts types of existing posts without losing data?

If you are skilled in sql scripting, you could write an sql script to manually update one post’s post type to another. Such an approach is cumbersome, however, and can lead to mistakes, mistakes that could prove costly if made on a production website. Additionally, what if you wanted to process only posts belonging to a specific taxonomy? Or, what if you wanted to process a bunch of posts in a bulk query? Your sql script would quickly become very complex.

There must be a better way to solve this problem? And there is!

You are not the only person faced with the problem of converting post types in WordPress. Others have been in the same situation, so much so that plugins exist for this exact purpose. The 2 most commonly used are the Post Type Switcher plugin and the Convert Post Types plugin. Both are compatible with the latest version of WordPress (3.5.1 as of writing this), both are fully functional and both are free.

While Post Type Switcher is probably easier to use, Convert Post Types comes with more features and allows you to for example convert posts from specific taxonomies and also assign taxonomies to newly converted posts. I recommend you try both and see which suits you better.

Leave a Reply