Support

Account

Home Forums ACF PRO Export / import results in wrong keys?

Solving

Export / import results in wrong keys?

  • Hi Eliot,

    I have an issue with exporting and then again importing my fields. I use the export file.

    Currently I have 3 enviroments; development, staging and producten. I’ve exported my fields multiple times in my development environment. First only some of the fields and later all of the fields. Before I imported this on the staging environment I’ve deleted the fields and deleted them from the trash. On my staging-environment everything went well every time.

    But when I just imported the on dev exported JSON file on producten, it DID actually import the files, and found all the contents belonging to the fields in de admin, but it couldn’t fetch them anymore in the templates. They simple returned nothing. The only thing I could do to make it work again, was re-saving all of the posts I had in WordPress, this made it work again.

    Do you have any idea how this can happen and what I can do about it to prevent it from happening next time?

    Thanks in advance,

    Jeroen.

  • I have exactly the same problem.

  • I think its the same problem as my problem:
    http://support.advancedcustomfields.com/forums/topic/relationship-field-works-after-click-update/

    And Bones problem: http://support.advancedcustomfields.com/forums/topic/using-update_field-for-taxonomy-terms/

    He found that it worked if he used the field_id instead of field_name when doing a get_field. Maybe that could solve your problem?

  • Hmm, that looks indeed like the same problem.
    But using the field id is also not a great solution because they are also different in every environment. If they would be the same across every environment (dev, staging, production), because the field was editable for example, that would be less annoying. Right now I have a file where I define all constants based on the environment to map the field key. But I actually hate doing that 🙁

    So, the text above hasn’t actually anything to do with the issue, but I think it explains why I don’t want to use the field id in get_field, for every field. So I hope it is possible to fix it in another way. It is particularly strange that it works after you update the post. So the relationship of the fields is still saved somewhere.

  • Hi @JeroenReumkens

    Sounds like the new Synchronized JSON feature on 5.1.5 will help you out:
    http://www.advancedcustomfields.com/resources/synchronized-json/

    Cheers
    E

  • Hi @Elliot Condon,
    This looks promising!
    Am I correct that the JSON file is always in version control on the dev file, and thereby would be deployed to staging / production environment. On those environments ACF would read the JSON file and see that it has updated fields and show me the ability to sync. Is this correct? 🙂

    Thanks for your reply,

    Jeroen.

  • Great solution!

    Thank you Elliot.

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

The topic ‘Export / import results in wrong keys?’ is closed to new replies.