There may come a time when you’ll want to convert a WordPress post to a page, a page to a post, a page to a Custom Post Type post, or some other option. Maybe you’re getting posts more organized or changing themes that have CPTs that you don’t want to disappear. This is easily and quickly accomplished with the help of a WordPress plugin.
Understanding Post Types
First, it’ll put your mind at ease that the wp_posts database table has a field called post_type. WordPress blog posts have a post_type of ‘post’. WordPress pages have a post_type of ‘page’. Uploaded Media creates an ‘attachment’ post_type entry. Other post types include nav_menu_item, revision, and those created by your plugins, themes, or functions.php code.
You wouldn’t want to change a ‘page’ to a ‘nav_menu_item’ or ‘attachment’, for example, so some common sense is in order. But you can now see that going into the database and changing a ‘post’ to a ‘page’ is as simple as that. WordPress will know what to do with the ‘page’ as if it had always been a page.
Considerations Before Switching Post Types
Just because you can doesn’t always mean you should. Carefully consider these items:
- Taxonomies (categories and tags)
- Custom Fields
- Post links (intra-site links, including menu navigation)
- Site structure
Comments, Taxonomies, and Custom Fields Considerations
Comments, Taxonomies, and Custom Fields are tied to the post’s ID, not the post’s post_type field. So switching the post’s type doesn’t lose the attached information (comments, et al.), but your theme or settings may not have comments enabled or may not display custom field content for the post type you switched to, for example.
Taxonomies are sometimes limited to certain post types. So the “Financial” blog post category might no longer be appropriate once switched to another post type. Just keep your desired organization in mind, since you won’t lose any taxonomy associations by switching post types, even if the CPT or theme doesn’t display it/them. Same goes for Custom Fields.
Post Links Considerations
WordPress will automatically redirect the post’s old link to the new location. For example, if the old post’s URL was example.com/?page_id=2 and you changed that ‘page’ post_type to an ‘attachment’ (not that you ever would want to), that URL would redirect to example.com/?attachment_id=2. If you have permalinks enabled, it’ll also redirect in line with your permalink rules.
Site Structure Considerations
Your top, side, and footer navigation links will redirect if they still go to the old URL, as explained above, but the visual display of these links may no longer be appropriate once a ‘page’ becomes a CPT post, for example. Another thing to keep in mind when planning and performing the post type change(s).
How to Convert Post Types
Once you’ve determined why and what you want to convert, you can use one or more of the following plugins to get the job done.
The single best all-around post type converter plugin I found was the pTypeConverter plugin because of its friendly user interface. You can search by post title, post type, author, and date. You can convert one or many/all at a time. And you can enable Logging to keep a history of the actions you performed:
Another bulk-editor plugin with some unique options is the Convert Post Types plugin. It has 2 useful filters: only convert if in a specified category and limit to the child pages of the selected page:
Sign up for more
Similarly, with the Post Type Convertr plugin, you can convert all of a single post type or a single taxonomy to a different post type or taxonomy:
The Post Type Switcher plugin adds a “Post Type” dropdown option to the “Publish” metabox on the post editor screen and an option to the Quick Edit area. Thus, it’s for changing the post_type of each post one-at-a-time. It’s a plugin from John James Jacoby, the BuddyPress/bbPress developer:
The Vice Versa plugin is another option (but not one I’d recommend since I prefer the alternatives above). It’s quite well-known, but I didn’t prefer its user interface or options. Also, there are premium features to purchase that are features other free plugins (listed above) can perform. But I didn’t want to leave it out since it’s well-known.
Remember to BACKUP YOUR DATABASE before performing any of the actions of these plugins. To be honest, there’s not much risk because they’re pretty much just changing the post type from ‘post’ to ‘page’, for example. You could even change one or more posts’ post_type value via PHPMyAdmin if you really wanted to. Just make sure to backup your database first.
Colorful Recycling Containers image courtesy of epSos.de