Skip to content

Instantly share code, notes, and snippets.

@samrap
Last active June 21, 2017 17:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samrap/d4a19858c2ed1d238c27df91580350e0 to your computer and use it in GitHub Desktop.
Save samrap/d4a19858c2ed1d238c27df91580350e0 to your computer and use it in GitHub Desktop.
Fix acf-json for Roots Sage 9
<?php
/**
* 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) {
$targetDir = get_template_directory().'/acf-json';
return (file_exists($targetDir) && is_dir($targetDir)) ? $targetDir : $path;
});
@samrap
Copy link
Author

samrap commented Feb 2, 2017

Update: This is now fixed in Sage 9 Beta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment