Skip to content

Instantly share code, notes, and snippets.

@guillaumemolter
Last active January 30, 2020 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guillaumemolter/4c9eb499ac4e64c55cb8f2e216363bec to your computer and use it in GitHub Desktop.
Save guillaumemolter/4c9eb499ac4e64c55cb8f2e216363bec to your computer and use it in GitHub Desktop.
ACF JSON Example
<?php
define( 'HSPH_PLUGIN_ASSETS_PATH', plugin_dir_path( __FILE__ ) . 'assets/' );
/**
* Saving ACF fields to assets folder.
*
* @return String The path where to save ACF json fields.
*/
add_filter(
'acf/settings/save_json',
function ( $path ) {
return HSPH_PLUGIN_ASSETS_PATH . 'acf/';
}
);
/**
* Loading ACF fields from assets folder.
*
* @return String The path where to load ACF json fields.
*/
add_filter(
'acf/settings/load_json',
function ( $paths ) {
$paths[] = HSPH_PLUGIN_ASSETS_PATH . 'acf/';
return $paths;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment