tgmpa

Helper function to register a collection of required plugins.

Description

tgmpa( (array) $plugins, (array) $config = array() ); 

Parameters (2)

0. $plugins (array)
An array of plugin arrays.
1. $config — Optional. (array) => array()
An array of configuration values.

Usage

  1. if ( !function_exists( 'tgmpa' ) ) { 
  2. require_once '/includes/class-tgm-plugin-activation.php'; 
  3.  
  4. // An array of plugin arrays. 
  5. $plugins = array(); 
  6.  
  7. // Optional. An array of configuration values. 
  8. $config = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = tgmpa($plugins, $config); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/class-tgm-plugin-activation.php  
  1. function tgmpa( $plugins, $config = array() ) { 
  2. $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); 
  3.  
  4. foreach ( $plugins as $plugin ) { 
  5. call_user_func( array( $instance, 'register' ), $plugin ); 
  6.  
  7. if ( ! empty( $config ) && is_array( $config ) ) { 
  8. // Send out notices for deprecated arguments passed. 
  9. if ( isset( $config['notices'] ) ) { 
  10. _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); 
  11. if ( ! isset( $config['has_notices'] ) ) { 
  12. $config['has_notices'] = $config['notices']; 
  13.  
  14. if ( isset( $config['parent_menu_slug'] ) ) { 
  15. _deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_menu_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' ); 
  16. if ( isset( $config['parent_url_slug'] ) ) { 
  17. _deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_url_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' ); 
  18.  
  19. call_user_func( array( $instance, 'config' ), $config );