0

I am just beginning a page, and for my current purposes it seems that the only extra things I need are a couple of extra fields for posts of a certain category. Because I only need to add a little information, I think that it might be appropriate to give posts belonging to this category custom fields using Advanced Custom Fields (aka ACF). However, I was thinking that later I might discover it is better to use custom post types, that have the fields built into the structure of the custom post type.

For example, imagine I originally start with normal posts, and I assign them all to the category of "movie". I give them each post in the category movie the custom field called "director" and populate it with the appropriate director. Then, later, if I want to create a custom post type, that has the field "director" as part of the custom post-type I create called "MovieType", could I easily transfer the directors in the custom fields for every old "normal post" of category "movie" to be imported to the new custom post type?

I am concerned it might not be easy to export this data to a custom post type later and I don't want to have to manually copy/paste or enter all the fields from my custom fields to the fields of the new custom post type.

The question: what is the easiest way to convert standard posts with custom fields into a new custom post type, AND to import/keep the data originally assigned to each post from the custom field into the native field of a new post type? Can this be done automatically?

Thanks!

0

The question: what is the easiest way to convert standard posts with custom fields into a new custom post type

There's no "easy" way. Consider that all posts have custom fields (some are hidden, and WordPress will add them). So you would need to convert post types based on the presence / value of specific custom fields.

This is not easy. It is doable with some SQL skills, but not "easy".

AND to import/keep the data originally assigned to each post from the custom field into the native field of a new post type? Can this be done automatically?

Changing post type means to change a column in the posts table. As long as the post ID column stays the same, the custom fields in meta table will stay unchanged, so you don't need to do anything to keep the data originally assigned to each post.

But as said above, there's no way to do it automatically, you'll need to run some SQL query on the database.

0

Perhaps this might help you with converting WP custom meta fields to ACF:

https://support.advancedcustomfields.com/forums/topic/help-converting-an-existing-custom-field-into-acf/

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.