Last active
September 16, 2022 10:46
-
-
Save theMikeD/b66840caefdcf8f34100 to your computer and use it in GitHub Desktop.
Changes the folder where ACF loads and saves the JSON file to and from
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 | |
add_filter('acf/settings/save_json', 'cnmd_set_acf_json_save_folder'); | |
add_filter('acf/settings/load_json', 'cnmd_add_acf_json_load_folder'); | |
/** | |
* Set a new location to save ACF field group JSON | |
* | |
* @param string $path | |
* @return string | |
*/ | |
function cnmd_set_acf_json_save_folder( $path ) { | |
// update path | |
// CHANGE THIS | |
$path = CNMD_CF_DIR . '/acf'; | |
// return | |
return $path; | |
} | |
/** | |
* Adds a folder to the ACF JSON load list | |
* | |
* @param array $paths | |
* @return array | |
*/ | |
function cnmd_add_acf_json_load_folder( $paths ) { | |
// Remove original path (optional) | |
unset($paths[0]); | |
// append path | |
// CHANGE THIS | |
$paths[] = $path = CNMD_CF_DIR . '/acf'; | |
// return | |
return $paths; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment