Home › Forums › ACF PRO › acf-json not updating › Reply To: acf-json not updating
Thought I’d add a little extra to this ticket for anyone else in the future. I use the JSON options on a ton of sites and run into the usual permission issue on the odd occasion but on one site my std install (a seperate file with acf filters and hooks) stopped syncing.
The file was loading correctly which is called into the theme on the functions page and loads
add_filter( 'acf/settings/save_json', array( $this, '_acf_json_save_point' ) );
add_filter( 'acf/settings/load_json', array( $this, '_acf_json_load_point' ) );
But for some reason while my class was loading these filters were not firing. Turns out there was a line above including my file that was using get_field an ACF function. Because this ran the filters did not load.
So in my case this would not work (BAD EXAMPLE)
define( 'MAIN_SITE_URL', get_field( 'main_site_url', 'option' ) );
//* ACF Hooks and Filters
include_once( get_stylesheet_directory() . '/lib/AcfExt.php' );
where the acf function was called before the rest of the filters. All it took to fix was changing the order and the hooks fired again as expected
(WORKING EXAMPLE)
//* ACF Hooks and Filters
include_once( get_stylesheet_directory() . '/lib/AcfExt.php' );
define( 'MAIN_SITE_URL', get_field( 'main_site_url', 'option' ) );
Hope this helps anyone else who has a random sync not showing up error
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.