Support

Account

Home Forums Add-ons Flexible Content Field Use PHP to add a field which can be managed in Admin? Reply To: Use PHP to add a field which can be managed in Admin?

  • I don’t think that you’re using the right function. ACF is looking for a path and not a URI, so that might be affecting it. Try get_template_directory()

    
    function my_acf_json_load_point( $paths ) {
        
        // remove original path (optional)
        unset($paths[0]);
        
        // append path
        $paths[] = get_template_directory() . '/acf-json-defaults';
        
        // return
        return $paths;
        
    }
    add_filter('acf/settings/load_json', 'my_acf_json_load_point');
    

    Saving works independently of loading. If you have an acf-json folder in the current them folder ACF will always save the json there. There can only be one save point and that can be changed as well with the acf/settings/save_json hook.