Home Forums General Issues Concepts of “Exporting PHP Code”


Concepts of “Exporting PHP Code”

  • I’ve been a decent user, and definitely fan, of ACF and ACF Pro for years. But I’m far from being a “developer”. I’m trying to wrap my head around using ACF as embedded code, rather than the UI, mostly from ongoing management or changes of such code in the long run. I just did my first “export as PHP” with 2 simple fields into a plugin that I had developed for a series of sites I manage, and it works great. I can see the benefits of having the ACF fields embedded in the plugin code, especially when transporting the plugin into new sites. I added the generated code into the plugin code, and then was able to delete the field from the ACF UI, and now the ACF fields come with the plugin.

    – What if I need to make changes to the fields and/or their settings? (Beyond basic fields or settings that I can do manually)
    – What if I need to add more fields to the Field Group?
    – And so on?

    Do I maintain the UI based code set on a separate site somewhere so I have the ability to make changes and re-export? Or is the concept that you would never have to make changes? Can I re-import hard-coded fields back into the UI, make the necessary changes, and the re-export back to code? (I searched for this concept to no avail)


  • The best choice here is to add and acf-json folder to your plugin, create an acf load point that points to the plugin folder, set the json file to privateacf load point
    so that it cannot be synced. Copy the JSON file from the theme to your plugin. When you need to make changes you remove the private setting on your dev site, sync the json and make changes. The JSON file will be saved in the theme again, then you move the new json file into your plugin folder.

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

You must be logged in to reply to this topic.