We use ACF across many of our sites, and have recently started using the Local JSON/Synced JSON functionality which has greatly improved our collaboration and efficiency when collaborating via git.
We’re at the point now where we are migrating our custom plugin meta boxes to ACF field groups, and loading the JSON content via the
acf/settings/load_json filter. Our issue is that it’s an arduous and error-prone process to make changes to these custom field groups once they’re saved in the individual plugin folders. Here’s our current process to update plugin field groups:
falsein plugin JSON file
/plugin/acf-json/, overwriting the previous version
truein plugin JSON file
What would make the process easier is if ACF would, when saving a local JSON file, check to see if the field group key exists in any of the
load_json locations and save it directly there, rather than in the single
save_json save point. This would eliminate the above steps 4, 5 and 6 from our workflow.
I think this logic could be made to happen in
advanced-custom-fields-pro/core/json.php in the
acf_write_json_field_group function. Even if this functionality isn’t desired by default, passing the
$path on line 194 through apply_filters like
$path = apply_filters( 'acf/settings/pre_save_json', $path, $field_group ); would allow me to do the check myself and alter the save location dynamically if desired.
My questions (finally, I know) are:
pre_save_jsonfilter be added to the plugin?
If you want to use ACF in your project but doesn’t want it to be changed from the backend, I suggest you register the fields trough PHP code instead. That way the field group won’t shows up on the editor page so the other collaborator won’t accidentally changed it. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/register-fields-via-php/. It will be a little bit difficult when you need to modify it, though.
If that doesn’t fit your needs, you can always submit a feature request by opening a new ticket here: https://support.advancedcustomfields.com/new-ticket. This will make sure that your request is passed directly to the plugin author.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Massive WP rebuild for a client launching next week:— Joseph Farruggio (@Joey_Farruggio) March 5, 2021
📑Over 10,000 blog posts
🧪A/B testing with Optimizely
📢Tons of custom Gutenberg @wp_acf blocks
⚡️100/100 for mobile on Lighthouse
Built with @Alpine_JS and @tailwindcss pic.twitter.com/Wb3CehMgx1
© 2021 Advanced Custom Fields. Subscribe