Last active
June 21, 2017 17:28
-
-
Save samrap/d4a19858c2ed1d238c27df91580350e0 to your computer and use it in GitHub Desktop.
Fix acf-json for Roots Sage 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update: This is now fixed in Sage 9 Beta.