Skip to content

Instantly share code, notes, and snippets.

@khromov
Created May 7, 2015 18:44
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 khromov/9d01c608e7b237719a4e to your computer and use it in GitHub Desktop.
Save khromov/9d01c608e7b237719a4e to your computer and use it in GitHub Desktop.
Store Advanced Custom Field Local JSON in plugin
<?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