Created
April 6, 2020 15:43
-
-
Save michaelbragg/3caadc472dba63a783a8072c3bd0f2ef to your computer and use it in GitHub Desktop.
Change path to store ACF JSON files outside the theme directory
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
| /** | |
| * Update ACF Local JSON save path. | |
| */ | |
| function ti_acf_json_save_point( $path ) { | |
| // Update save file path. | |
| $path = WPMU_PLUGIN_DIR . '/acf-json'; | |
| return $path; | |
| } | |
| add_filter( | |
| 'acf/settings/save_json', | |
| 'ti_acf_json_save_point' | |
| ); | |
| /** | |
| * Update ACF Local JSON load path. | |
| */ | |
| function ti_acf_json_load_point( $paths ) { | |
| // Remove original path (optional). | |
| unset($paths[0]); | |
| // Append load path. | |
| $paths[] = WPMU_PLUGIN_DIR . '/acf-json'; | |
| return $paths; | |
| } | |
| add_filter( | |
| 'acf/settings/load_json', | |
| 'ti_acf_json_load_point' | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment