While working with custom post types in WordPress, many times we come across the need to change the post type of a particular post.
It can be done either directly through code or using a plugin.
Without Plugin
This can be done using WordPress functions- wp_update_post or set_post_type.
wp_update_post
can be used when updating multiple fields of a post.
In case, only post type has to be changed, then set_post_type
is sufficient.
Just use set_post_type
along with the post id and you are done.
If you are unsure about where to add this code, take a look at Where to add custom code in WordPress.
Using Plugin
If you occasionally want to switch posts and do not want to fiddle with the code, there is a good plugin for this which easily performs this task- Post Type Switcher.
Simply install and activate a plugin. It will add the option to change post types in the admin menu.
A good thing about this plugin is that it allows to change the post type of multiple posts in bulk by utilizing the "bulk edit" feature in WordPress.
So, now you know how to change post type with or without a plugin. Which one do you like better? Do let me know in comments section.