Created
May 7, 2015 18:44
-
-
Save khromov/9d01c608e7b237719a4e to your computer and use it in GitHub Desktop.
Store Advanced Custom Field Local JSON in plugin
This file contains hidden or 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 | |
/* | |
Plugin Name: ACF Local JSON plugin | |
Plugin URI: | |
Description: Put this file in a plugin folder and create an /acf directory inside the plugin, ie: /my-plugin/acf | |
Author: khromov | |
Version: 0.1 | |
*/ | |
//Change ACF Local JSON save location to /acf folder inside this plugin | |
add_filter('acf/settings/save_json', function() { | |
return dirname(__FILE__) . '/acf'; | |
}); | |
//Include the /acf folder in the places to look for ACF Local JSON files | |
add_filter('acf/settings/load_json', function() { | |
$paths[] = dirname(__FILE__) . '/acf'; | |
return $paths; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment