I’m working on a project on several computers, so I keep ACF fields in the
acf-json dir and commit it to the repo. When ACF fields are changed then a “sync” options appears in the ACF admin panel… usually.
Today I’ve noticed a strange thing. ACF json file got modified. I’ve seen a modified file in the
acf-json dir but the sync option wasn’t available. The newly added fields were visible on the post edit pages, but on the “Edit field group” screens I’ve seen the old data.
I tried to modify the timestamp (the “modified”) field in the *.json file manually, I hoped that it will force ACF to “see” the file was modified, but it didn’t help.
Finally, I made a backup of the
acf-json directory, removed the directory, removed all fields groups from the admin panel, restored the
acf-json directory – and then the
sync option appeared and I was able to synchronise the fields.
I’m afraid I can’t tell what caused the problem, and I cannot reproduce it. Tell me what else can I provide you with in order to make it easier to find what caused that strange behaviour, because it’s definitely a bug.
Same problem here. Updating Local JSON files, and even the “modified” value, doesn’t result in the fields group being ‘available for sync’. Is it a bug or I’m missing some step?
Is there a way to manually trigger the function that checks if there’s available syncs?
There is only one thing that I can thing of that would cause this to happen and that is that the timestamp in the JSON file is less than the last modified date (GMT) of the acf-field-group post. This could happen if someone edited/updated the field group later then what the timestamp in the JSON file is.
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
//* 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
You must be logged in to reply to this topic.
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!
© 2021 Advanced Custom Fields. Subscribe