Last active
February 13, 2018 20:43
-
-
Save chrisjuer/9ede680207dcd9df90c38b560646536f to your computer and use it in GitHub Desktop.
Include Advanced Custom Fields plugin into own plugin
This file contains hidden or 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
// Customize path to ACF in own plugin | |
add_filter('acf/settings/path', 'my_acf_settings_path'); | |
function my_acf_settings_path( $path ) { | |
// update path | |
$path = plugin_dir_path(__FILE__) . '/pluginname/lib/acf/'; | |
// return | |
return $path; | |
} | |
// Customize directory to ACF in own plugin | |
add_filter('acf/settings/dir', 'my_acf_settings_dir'); | |
function my_acf_settings_dir( $dir ) { | |
// update path | |
$dir = plugins_url() . '/pluginname/lib/acf/'; | |
// return | |
return $dir; | |
} | |
// Do not show ACF in backend of WordPress | |
add_filter('acf/settings/show_admin', '__return_false'); | |
// Include ACF to own plugin | |
include_once( plugin_dir_path( __FILE__ ) . 'lib/acf/acf.php' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment