Change Post Types with the Post Type Switcher Plugin for WordPress

photo credit: contemplative imaging - cc
photo credit: contemplative imagingcc

When WordPress 3.0 introduced the ability for developers to register their own custom post types, the software became far more flexible for use as a content management system. This was a major turning point for WordPress, as it gave developers a standard way to structure custom content with core-supported features.

Four years later, custom post types are so commonly used that folks occasionally need a way to switch a post from one type to another. A site admin may want to change how content is structured and presented, and switching content to a new post type can be a huge time saver in some instances.

The Post Type Switcher plugin, authored by John James Jacoby, was created for exactly this purpose. It’s one of those plugins that you may not have ever known about until you’re on the hunt to find a way to convert a post from one type to another.

The plugin adds a simple post type dropdown to the post editor, which allows you to reassign any post to a new post type.

post-type-switcher

The handy thing is that Post Type Switcher can convert nearly every combination of posts, pages, attachments, custom post types, etc:

  • Page to Post
  • Post to Page
  • Page to Attachment
  • Post to Custom

What happens when you change a post to a different type? Only the 'post_type' property of a post is changed. Categories, tags, and custom taxonomies all remain untouched. Featured images remain in place. The post’s URL will change to whatever the new post type uses. For example, if you change a regular post to a testimonial post type that uses /testimonial/ in the URL, your newly converted post will follow the pattern of its new post type.

The old post URL should 404 so that you can use a plugin to redirect to the new URL or add some custom rewrite rules to your .htaccess file. While testing the plugin with different post types, I only encountered one instance where a plugin didn’t properly 404 the original post, but most of the time you won’t have an issue with this.

Jacoby has purposely excluded invisible post types, such as revisions, menus, etc., but you can filter 'pts_post_type_filter' to change how this works if you need access to more post types.

Matthew Gerring, a contributor to the plugin, helped to add bulk editing so that you can select all posts in a certain type and convert them to a new type with one quick action.

Post Type Switcher is very useful if you started out putting content in regular posts but now want to move it into a portfolio plugin or testimonial plugin. Or perhaps you’ve been running bbPress on your site and want to extract a few of the most active posts to become regular blog posts instead. Another common use might be to convert a bunch of posts to pages in order to create a static reference section for your site. This plugin makes all of that possible.

If you’re planning to use the plugin, make sure to test your post type switches in a development environment first. It’s also a good idea to backup your live site before making drastic changes to content. You can find Post Type Switcher in the WordPress.org Plugin Directory.

8

8 responses to “Change Post Types with the Post Type Switcher Plugin for WordPress”

  1. I used the bulk editing feature of Post Type Switcher a year or so ago when I was doing some site restructuring adding custom post types. I coupled it with the Taxonomy Converter plugin to handle custom taxonomies for the new CPTs. In one case I was going from page to CPT, so used the approach covered here, http://www.markwarddesign.com/2014/02/remove-custom-post-type-slug-permalink/ (the original WP VIP link no longer works), to keep the URLs the same.

    It’s definitely a valuable, temporary niche plugin. And, as you mention, these types of changes are definitely best tested on a staging site before going live!

    • Yes, it’s a bit hidden, and not covered by the plugin FAQs. From the Posts or Pages or CPT list, select the checkbox for several posts. From the Bulk Actions dropdown select Edit and then Apply. You’ll see several properties that can be in Bulk, one is Post Type.
      Good luck!

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.