Skip to content

Instantly share code, notes, and snippets.

@theMikeD theMikeD/acf.php
Last active Dec 19, 2018

Embed
What would you like to do?
Changes the folder where ACF loads and saves the JSON file to and from
<?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
You can’t perform that action at this time.