• Resolved doublesharp

    (@doublesharp)


    The acfe_folder_exists($folder) function is only used to check for the existence of the THEME + /acf-json folder to determine if the ACF->JSON sync is enabled. This function is a bit generic, but is only used in 2 places and both check for the same folder (./acf-json). The issue is that this path can be customized using the acf/settings/save_json filter, and in my case I would like to save them to WP_CONTENT_DIR + /acf-json to allow us to change themes and keep the same ACF settings.

    This has been added to WP_CONTENT_DIR/mu-plugins/functions.php:

    add_filter('acf/settings/save_json', function( $path ) {  
      return WP_CONTENT_DIR . '/acf-json';  
    });

    Instead of passing in the $path, using the acf_get_setting('save_json') function to get the path will run it through the filters and then will return is_dir() on the correct location. Perhaps this could be a different function if you intend to check for other folders in the theme at some point.

    /**
     * JSON folder Exists
     */
    function acfe_json_folder_exists(){
    
        $json_path = acf_get_setting('save_json');
    
        return is_dir($json_path);
        
    }

    As a side note, if you have your code somewhere I can submit a PR I would be happy to do so. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter doublesharp

    (@doublesharp)

    Looking at this a bit more it seems like the 'acf/settings/load_json' filter is being used by ACFE, and the above really only affect the warning message if the settings files can’t be found, so not urgent but may still be useful. Thanks again!

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Yes you’re right, acfe_folder_exists() is only used for warning message in field groups & single field group for Json/PHP Sync. Indeed, warnings should check acf/settings/load_json. I’ll fix it in the next patch.

    Thanks for the report!

    Regards.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello doublesharp,

    Just to let you know that the latest ACF Extended 0.8.3 Update now correctly check the load_json setting, as expected!

    Thanks again for the report. Have a nice day!

    Regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Support custom `/acf-json` locations’ is closed to new replies.