Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Include Meta Box extension in themes/plugins
require_once get_template_directory() . '/class-tgm-plugin-activation.php'; // Path to TGM Plugin Activation class.
add_action( 'tgmpa_register', 'your_prefix_register_required_plugins' );
function your_prefix_register_required_plugins() {
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
$plugins = array(
// This is an example of how to include a plugin bundled with a theme.
'name' => 'Extension Name', // The plugin name.
'slug' => 'extension-slug', // The plugin slug (typically the folder name).
'source' => get_stylesheet_directory() . '/lib/plugins/', // The plugin source.
'required' => true, // If false, the plugin is only 'recommended' instead of required.
$config = array(
'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'parent_slug' => 'themes.php', // Parent menu slug.
'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
'has_notices' => true, // Show admin notices or not.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'theme-slug' ),
'menu_title' => __( 'Install Plugins', 'theme-slug' ),
tgmpa( $plugins, $config );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.