6

I have a Wordpress site that I just updated to 3.1. I want to make use of custom post types now, my question is how can I assign (transfer?) a post to a newly created custom post type ?

For example, all my articles (news, poems, ideas to change the world) are in Posts. Now I have created the custom post types News, Poems, etc. and I want to transfer my old posts to these new custom post types.

I hope this is clear enough, anybody ?

11

It seems that the easiest way is to do it manually in the DB. If you don't have access to the DB, or if you don't want to do it manually, you can install a plugin that will do it one post at a time, or a plugin that will bulk convert a lot of posts at once

4

there is a great plugin Post Type Switcher that gives you simple way to change a post type in WordPress.

3

You can use "Convert Post Type" to convert from your categories to custom post types that you have already defined.

This plugin will convert all your selected categories to a custom post type that you can choose.

1

For those who are looking for a code solution:

$post_id             = 123; // Set this to the ID of the post you want to update.
$post_obj            = get_post( $post_id );
$post_obj->post_type = 'custom-post-type'; // Set this to the slug of your custom post type.
wp_update_post( $post_obj );    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.