Skip to content

Instantly share code, notes, and snippets.

@michaelbragg
Created April 6, 2020 15:43
Show Gist options
  • Select an option

  • Save michaelbragg/3caadc472dba63a783a8072c3bd0f2ef to your computer and use it in GitHub Desktop.

Select an option

Save michaelbragg/3caadc472dba63a783a8072c3bd0f2ef to your computer and use it in GitHub Desktop.
Change path to store ACF JSON files outside the theme directory
/**
* 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