Skip to content

Instantly share code, notes, and snippets.

@chrisjuer
Last active February 13, 2018 20:43
Show Gist options
  • Save chrisjuer/9ede680207dcd9df90c38b560646536f to your computer and use it in GitHub Desktop.
Save chrisjuer/9ede680207dcd9df90c38b560646536f to your computer and use it in GitHub Desktop.
Include Advanced Custom Fields plugin into own plugin
// 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