acf fields in theme
/********************************/
// Save and load plugin specific ACF field groups via the /acf-json folder.
/********************************/
// Save
function my_plugin_update_field_group($group) {
// list of field groups that should be saved to my-plugin/acf-json
$groups = array('group_5d921d2978e9e');
if (in_array($group['key'], $groups)) {
add_filter('acf/settings/save_json', function() {
return dirname(__FILE__) . '/acf-json';
});
}
}
add_action('acf/update_field_group', 'my_plugin_update_field_group', 1, 1);
// Load - includes the /acf-json folder in this plugin to the places to look for ACF Local JSON files
add_filter('acf/settings/load_json', function($paths) {
$paths[] = dirname(__FILE__) . '/acf-json';
return $paths;
});