Title: get_mu_plugins
Published: April 25, 2014
Last modified: August 20, 2026

---

# get_mu_plugins(): array[]

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_mu_plugins/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/functions/get_mu_plugins/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_mu_plugins/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_mu_plugins/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_mu_plugins/?output_format=md#changelog)

Checks the mu-plugins directory and retrieve all mu-plugin files with any plugin
data.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_mu_plugins/?output_format=md#description)󠁿

WordPress only includes mu-plugin files in the base mu-plugins directory (wp-content/
mu-plugins).

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_mu_plugins/?output_format=md#return)󠁿

 array[] Array of arrays of mu-plugin data, keyed by plugin file name. See [get_plugin_data()](https://developer.wordpress.org/reference/functions/get_plugin_data/).

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_mu_plugins/?output_format=md#source)󠁿

    ```php
    function get_mu_plugins() {
    	$wp_plugins   = array();
    	$plugin_files = array();

    	if ( ! is_dir( WPMU_PLUGIN_DIR ) ) {
    		return $wp_plugins;
    	}

    	// Files in wp-content/mu-plugins directory.
    	$plugins_dir = @opendir( WPMU_PLUGIN_DIR );
    	if ( $plugins_dir ) {
    		while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
    			if ( str_ends_with( $file, '.php' ) ) {
    				$plugin_files[] = $file;
    			}
    		}
    	} else {
    		return $wp_plugins;
    	}

    	closedir( $plugins_dir );

    	if ( empty( $plugin_files ) ) {
    		return $wp_plugins;
    	}

    	foreach ( $plugin_files as $plugin_file ) {
    		if ( ! is_readable( WPMU_PLUGIN_DIR . "/$plugin_file" ) ) {
    			continue;
    		}

    		// Do not apply markup/translate as it will be cached.
    		$plugin_data = get_plugin_data( WPMU_PLUGIN_DIR . "/$plugin_file", false, false );

    		if ( empty( $plugin_data['Name'] ) ) {
    			$plugin_data['Name'] = $plugin_file;
    		}

    		$wp_plugins[ $plugin_file ] = $plugin_data;
    	}

    	if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php' ) <= 30 ) {
    		// Silence is golden.
    		unset( $wp_plugins['index.php'] );
    	}

    	uasort( $wp_plugins, '_sort_uname_callback' );

    	return $wp_plugins;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/plugin.php#L365)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/plugin.php#L365-L414)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_mu_plugins/?output_format=md#related)󠁿

| Uses | Description | 
| [get_plugin_data()](https://developer.wordpress.org/reference/functions/get_plugin_data/)`wp-admin/includes/plugin.php` |

Parses the plugin contents to retrieve plugin’s metadata.

  |

| Used by | Description | 
| [WP_Debug_Data::get_wp_mu_plugins()](https://developer.wordpress.org/reference/classes/wp_debug_data/get_wp_mu_plugins/)`wp-admin/includes/class-wp-debug-data.php` |

Gets the WordPress MU plugins section of the debug data.

  | 
| [WP_Plugins_List_Table::prepare_items()](https://developer.wordpress.org/reference/classes/wp_plugins_list_table/prepare_items/)`wp-admin/includes/class-wp-plugins-list-table.php` |

Prepares the list of items for displaying.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_mu_plugins/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_mu_plugins%2F)
before being able to contribute a note or feedback.