How to switch / convert Custom Post Types In WordPress


Custom post type is one of the most powerful feature of wordpress that give its developer immense power to customize this very simple to use blogging platform to convert it to suite any requirement. Premiums Themes and plugins do use custom post types to store testimonials, photo galleries, portfolios, companies profiles, this list is endless.

But this is also an issue when you want to change your theme or the plugin you are using on your site, is no longer maintained.

What will you do ? Will write the whole information again?

WordPress save all type of post information in a single file wp_posts table and defined the type of post in an attribute post_type using this information you can convert all or any of your custom post into normal wordpress post.

Luckily, there’s a couple ways to convert custom post types to standard post types. I recommend using Post Type Switcher if you just have a couple items to switch. For converting posts in bulk, Post Type Converter is what you’ll want.

Convert Custom Post Types using Command Prompt

Please make very sure that you have proper backup of your database before executing the following

Login into Phpadmin Panel of Your Database, select your database and issue the following command in command Prompt

update wp_posts set post_type =’Your New Post Type’  where post_type =’Old Post Type’

Example

Update wp_posts  set post_type =”post” where post_type =”testimonials”

Above sql query will convert testimonials type custom posts as your regular posts.

but if you want to convert any specific post into another type then you can issue this command

Update wp_posts  set post_type =”post” where post_type =”testimonials”  AND  id =45

where 45 is the post number of your post.

Change Custom Post Type Using post Type Switcher/Post Type Converter

if you are little bit less comfortable with programming and using phpmyadmin, then use these plugins, specially built to convert one post type into another post type- Post Type Switcher

Convert custom Post Types

The problem with this WordPress plugins is- You have to convert one post at a time into another post type but very useful, if you have very few post to convert.

In case you want to convert a good amount of custom post into another post type then post type converter is for you. ( This plugin is not updated for more than 2 years, so use this plugin at your own risk )

Adds meta boxes to all post types and allows you to convert the post type of the current post you are editing to a different post type. This is very useful when doing an import from another site into one post type that then needs to be filtered into different post types or even to fill dummy posts throughout multiple post types




6 Brilliant Comments - Join Discussion Now!

  1. Hamish says:

    Isnt there any plugin to do this process?

    • rakesh says:

      Dear Hamish =, i think you have not read this article properly, Already listed two plugins for this purpose in this article.

  2. Riya Khurana says:

    great sharing..
    I will try these two plugins….I hope there will be no problem to use it..
    BTW thanks for sharing such an useful information

    • rakesh says:

      There is no problem to use any of them at all but the total audience is totally different. So use according to your requirement. Keep in touch riya

  3. Hello Rakesh, It is a very useful tricks for the blogger who doesn’t have tried this earlier. I have use Post Type Converter because it converts posts in bulks. Thanks a lot for sharing this informative tricks with the binarynote readers.

    • rakesh says:

      You are most welcome vikas, I would suggest you to read my affiliate related articles positively they will help you to earn some money from your blog. Keep in touch

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>