Last active
January 30, 2020 16:04
-
-
Save guillaumemolter/4c9eb499ac4e64c55cb8f2e216363bec to your computer and use it in GitHub Desktop.
ACF JSON Example
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 | |
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