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:
private
field to false
in plugin JSON file/theme/acf-json/
to /plugin/acf-json/
, overwriting the previous version/theme/acf-json
/theme/acf-json/
private
field to true
in plugin JSON fileWhat 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_json
filter be added to the plugin?Thanks much!
Hi @sblomberg
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.
Thanks 🙂
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!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG
— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.