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 !!
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.