Support

Account

Home Forums General Issues get_field returning null after update Reply To: get_field returning null after update

  • No news from support yet… in the meantime I’ve discovered more details about that bug (which could explain why @dany0 didn’t always get the same results as I did)

    So with a custom Settings Option page loaded only from a JSON file (NOT SYNC’ed) and for example an option called “goshow_blabla_percent”

    – From a sidebar PHP widget, this WORKS :

    
    <?php
    
    echo "get_field value is:" . get_field('goshow_blabla_percent', 'option') . "END";
    
    ?>
    

    But from my plugin, using this :

    
    add_filter('acf/settings/save_json', 'gowf_acf_json_save_point');
    function gowf_acf_json_save_point( $path ) {
    // update path
    $path = BJAWF_PLUGIN_PATH . 'acf-config';
    // return
    return $path;
    }
    
    add_filter('acf/settings/load_json', 'gowf_acf_json_load_point');
    function gowf_acf_json_load_point( $paths ) {
    // remove original path (optional)
    unset($paths[0]);
    // append path
    $paths[] = BJAWF_PLUGIN_PATH . 'acf-config';
    // return
    return $paths;
    }
    
    $value = get_field('goshow_blabla_percent', 'option');
    

    => Will set $value to NULL…

    it has been working for years but it doesn’t work with 5.11 !!