Last active
March 4, 2018 15:09
-
-
Save psaikali/d5128e07c49fffdb8ca22b413b384454 to your computer and use it in GitHub Desktop.
Enregistrer les configurations des metaboxes/champs d'ACF dans un dossier d'un plugin
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 | |
// Article/tutoriel complet sur https://mosaika.fr/astuces-developpement-acf/ | |
// Documentation officielle https://www.advancedcustomfields.com/resources/local-json/ | |
define('MSK_ACF_PATH', plugin_dir_path(__FILE__)); | |
/** | |
* Enregistrer la config de ses metaboxes & champs ACF dans un dossier de son plugin/thème | |
* Filtre : acf/settings/save_json | |
*/ | |
function msk_acf_change_json_save_point($path) { | |
$path = MSK_ACF_PATH . 'acf-fields'; | |
return $path; | |
} | |
add_filter('acf/settings/save_json', 'msk_acf_change_json_save_point'); | |
/** | |
* Charger la config de ses metaboxes & champs ACF dans un dossier de son plugin/ | |
* Filtre : acf/settings/load_json | |
*/ | |
function msk_acf_change_json_load_point($path) { | |
$path[] = MSK_ACF_PATH . 'acf-fields'; | |
return $path; | |
} | |
add_filter('acf/settings/load_json', 'msk_acf_change_json_load_point'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment