Skip to content

Instantly share code, notes, and snippets.

@reidelliott
Created May 25, 2018 04:34
Show Gist options
  • Save reidelliott/8ce69b73243cdb6b7753c47c6eb27d27 to your computer and use it in GitHub Desktop.
Save reidelliott/8ce69b73243cdb6b7753c47c6eb27d27 to your computer and use it in GitHub Desktop.
/**
* Fix location of ACF local JSON.
*
* Since Sage does some surgery on the WordPress template locations, ACF looks in
* the wrong location for the acf-json directory. We will fix this by manually
* hooking into that functionality and attempting to save in the right spot.
*
* @param string $path
* @return string
*/
add_filter('acf/settings/save_json', function ($path) {
$acf_json_dir = get_template_directory().'/acf-json';
return (file_exists($acf_json_dir) && is_dir($acf_json_dir)) ? $acf_json_dir : $path;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment