wp_get_mu_plugins

Retrieve an array of must-use plugin files.

Description

(array) wp_get_mu_plugins(); 

The default directory is wp-content/mu-plugins. To change the default directory manually, define WPMU_PLUGIN_DIR and WPMU_PLUGIN_URL in wp-config.php.

Returns (array)

Files to include.


Usage

  1. if ( !function_exists( 'wp_get_mu_plugins' ) ) { 
  2. require_once ABSPATH . WPINC . '/load.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_get_mu_plugins(); 
  7.  

Defined (1)

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

/wp-includes/load.php  
  1. function wp_get_mu_plugins() { 
  2. $mu_plugins = array(); 
  3. if ( !is_dir( WPMU_PLUGIN_DIR ) ) 
  4. return $mu_plugins; 
  5. if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) ) 
  6. return $mu_plugins; 
  7. while ( ( $plugin = readdir( $dh ) ) !== false ) { 
  8. if ( substr( $plugin, -4 ) == '.php' ) 
  9. $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin; 
  10. closedir( $dh ); 
  11. sort( $mu_plugins ); 
  12.  
  13. return $mu_plugins;