Support

Account

Home Forums General Issues migrate acf options to custom fields

Solving

migrate acf options to custom fields

  • hello
    in my theme option i created some options for sliders and other repeater option
    in this way i limited to 1 slider per any sliders that exists .
    so, i decide to migrate this options to custom post types for remove limitation and create unlimited of sliders and other repeater or elements .

    is there a way for migrate options (max item is 1 per any slider or repeater) to custom post type programmatically ?
    thanks

  • hi @enter64

    Are you wanting to move the data that you saved to those sliders to your custom post types? Or are you wanting to move the ACF fields you’ve created to the new custom post type?

    If the former you could remap the data to the custom post types by using the get_field() and update_field() functions. Just loop through the old data, and remap the values to the new custom post type posts.

    Phil

  • hi my friend
    i want to migrate exists options page setting to Custom Post Type .
    unfortunately i couldn’t understand your way .
    Can you descripe more ?
    thanks

  • hi @enter64

    if you’re just wanting to migrate ACF fields via the ACF Editor, you can just change where the fields are being displayed.

    If you’d like, you can use something like http://recordit.co/ to show me what you’re trying to do.

    Phil

  • no no , my theme is now using by more than 500 customers .
    for create unlimited numbers of any options, i move this options to custom post type .
    and now i want prevent manual migrating by my customers and i want do it programmatically .
    can you show me a way for doing it ?
    thanks

  • hi @enter64

    If you use the methods above, you should be able to figure that out. You just need to loop through the data you have and remap it.

    You can use WordPress’ wp_insert_post to create the new posts and then remap the fields using ACF’s update_field() functionality.

    You’ll need to make sure those fields are set up for the custom post types via the ACF Admin before you can do the remapping.

  • i haven’t any problem with insert new fields into CPT .
    i confuse that acf create more that 1 row per any option in wp_options table .
    and i don’t know that i have to create that extra info for any option in post_meta
    thanks

  • @enter64 i don’t think it matters how ACF does it – you don’t need to copy the database structure over.

    1. Set up the new fields for the custom post types
    2. Loop through the old data you have stored
    3. Create a new Post and remap that data

    If you’re trying to just do a database migration, I think you’re over thinking the problem. Just remap, then delete the old data.

    If you’re wanting to do this all via SQL, then I’ll have to defer to someone who has more expertise in that area.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.