Home › Forums › ACF PRO › acf-json fields not loading from parent theme › Reply To: acf-json fields not loading from parent theme
@okadots The acf/settings/save_json
filter needs a single path, where the JSON files should be saved while working in admin.
But if you want to load JSON files from multiple folders, you should use the acf/settings/load_json
and return an array of paths 🙂
I’m guessing you want something like this:
add_filter('acf/settings/load_json', 'my_acf_json_load_point');
function my_acf_json_load_point( $paths = array() ) {
$paths = array( THEME_DIR . '/config/acf-configs/acf-json' );
if ( is_child_theme() ) {
$paths[] = CHILD_THEME_DIR . '/config/acf-configs/acf-json';
}
return $paths;
}
And save to child theme dir when working in child theme?
add_filter('acf/settings/save_json', 'my_acf_json_save_point');
function my_acf_json_save_point( $path = '' ) {
$path = THEME_DIR . '/config/acf-configs/acf-json';
if ( is_child_theme() ) {
$path = CHILD_THEME_DIR . '/config/acf-configs/acf-json';
}
return $path;
}
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.