Skip Navigation

[Resolved] Converting custom types to posts or page

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to convert custom post types. A lot of imported content is of various post types, the client wants to convert them all to the same type.

Solution:
You can edit the post_type entries in wp_posts in the database directly, but the easiest solution is to use a plugin for the purpose, such as https://wordpress.org/plugins/post-type-switcher/

This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 5 replies, has 2 voices.

Last updated by Nigel 6 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#596517

The site I'm working on has a bunch of content imported from Drupal using Frederic Gilles's importer and your Types plugin.

The site created a bunch of Drupal content types and then imported the data.

But the content types aren't actually any different from each other. The "Bulletin" content type has the same fields more or less as WordPress's built-in "Post" content type. They clutter the site and make it more difficult to build lists of content

I would like to convert them into posts and/or pages. Is that possible?

hidden link

#596627

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Chris

No reason not to do this.

You could change post type directly in the database with a SQL query, but it's easier to use a plugin such as https://wordpress.org/plugins/post-type-switcher/

It has a bulk-edit option to change all posts of a type to another type.

#597706

That plugin works (https://wordpress.org/plugins/post-type-switcher/) but if there's data in a Custom Type's field and the content type you're converting to doesn't have that field, the data gets lost.

I wonder if there's one that lets you map similar fields.

cmkl

#597709

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Chris

I'm surprised that the plugin does much more than change the post_type column in the wp_posts table for each affected post, so I wouldn't expect the custom fields data to be lost, it is stored in wp_postmeta and is connected to the post with the post_id key.

I suggest you look in the database and see whether the posts simply had their post_type changes, and, if so, whether those individual posts still have entries in wp_postmeta for the custom fields (Types custom fields are stored with a prefix of 'wpcf-').

If the fields are just "missing" in the back end when editing a post it may be that you just need to edit the Post Field Group and change which custom post types the custom fields are assigned to.

#597721

Good lord. Am I ever glad I mentionned that. You are, of course, right. And with that little bit of advice you've just saved me a ton of time.

I added the field I needed to 'bring over' from the old post type to the new post type and now when I convert post types, the data is present.

Close this thread, please. I'm well sorted. I just can't post this thank you not without reopening the ticket.

cmkl

#597724

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Glad to hear that!