Home › Forums › General Issues › Multiple JSON load points?
Is it possible to load field groups from two JSON folders? That is, one folder in a plugin, and another in the theme? My reading of http://www.advancedcustomfields.com/resources/local-json/ is that we can only have one load point.
Alternatively, can I load some field groups from the JSON folder in the plugin while registering another group via PHP in the theme’s functions.php? My sense is that ACF will also ignore PHP registration if it finds a JSON load point first.
By way of explanation, I’m developing a new theme for a network of about 100 sites. All the subsites will move to the new theme. The head site runs on a child of the new theme.
Three of my field groups let the subsites pass data that is displayed only on the head site. So, they’re not really theme-specific, and I want the fields to active on the subsites before they move to the new theme, as well as in the future when the subsites inevitably move on to new themes.
My fourth field group is theme-specific, so, ideally, it should get loaded by the theme, not the plugin.
Suggestions? If I can’t move the fourth group out of the plugin I suppose I could just hide the fourth group via admin CSS in the future when it starts to become obsolete.
You can have multiple load points.
You can only have one save point, although it is possible to manipulate the save point during the saving of specific field groups using a combination of filters ‘acf/update_field_group’ and ‘acf/settings/save_json’
ACF loads JSON versions of field groups first. It then loads field groups from the DB for any field groups that do not have a JSON file based on group key.
The only reason that fields registered in PHP would not override JSON is if the group key of your group added in PHP matches an already existing group key. Group keys and field keys in php loaded groups must be unique and not match group keys or field keys that exist in other field groups.
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.