Support

Account

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;
    }