wp_get_mu_plugins

The timeline below displays how wordpress function wp_get_mu_plugins has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Retrieves an array of must-use plugin files.
 *
 * 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.
 *
 * @since 3.0.0
 * @access private
 *
 * @return string[] Array of absolute paths of files to include.
 */
function wp_get_mu_plugins()
{
    $mu_plugins = array();
    if (!is_dir(WPMU_PLUGIN_DIR)) {
        return $mu_plugins;
    }
    $dh = opendir(WPMU_PLUGIN_DIR);
    if (!$dh) {
        return $mu_plugins;
    }
    while (($plugin = readdir($dh)) !== false) {
        if (str_ends_with($plugin, '.php')) {
            $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
        }
    }
    closedir($dh);
    sort($mu_plugins);
    return $mu_plugins;
}

WordPress Version: 5.5

/**
 * Retrieve an array of must-use plugin files.
 *
 * 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.
 *
 * @since 3.0.0
 * @access private
 *
 * @return string[] Array of absolute paths of files to include.
 */
function wp_get_mu_plugins()
{
    $mu_plugins = array();
    if (!is_dir(WPMU_PLUGIN_DIR)) {
        return $mu_plugins;
    }
    $dh = opendir(WPMU_PLUGIN_DIR);
    if (!$dh) {
        return $mu_plugins;
    }
    while (($plugin = readdir($dh)) !== false) {
        if ('.php' === substr($plugin, -4)) {
            $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
        }
    }
    closedir($dh);
    sort($mu_plugins);
    return $mu_plugins;
}

WordPress Version: 5.4

/**
 * Retrieve an array of must-use plugin files.
 *
 * 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.
 *
 * @since 3.0.0
 * @access private
 *
 * @return string[] Array of absolute paths of files to include.
 */
function wp_get_mu_plugins()
{
    $mu_plugins = array();
    if (!is_dir(WPMU_PLUGIN_DIR)) {
        return $mu_plugins;
    }
    $dh = opendir(WPMU_PLUGIN_DIR);
    if (!$dh) {
        return $mu_plugins;
    }
    while (($plugin = readdir($dh)) !== false) {
        if (substr($plugin, -4) == '.php') {
            $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
        }
    }
    closedir($dh);
    sort($mu_plugins);
    return $mu_plugins;
}

WordPress Version: 5.3

/**
 * Retrieve an array of must-use plugin files.
 *
 * 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.
 *
 * @since 3.0.0
 * @access private
 *
 * @return array Files to include.
 */
function wp_get_mu_plugins()
{
    $mu_plugins = array();
    if (!is_dir(WPMU_PLUGIN_DIR)) {
        return $mu_plugins;
    }
    $dh = opendir(WPMU_PLUGIN_DIR);
    if (!$dh) {
        return $mu_plugins;
    }
    while (($plugin = readdir($dh)) !== false) {
        if (substr($plugin, -4) == '.php') {
            $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
        }
    }
    closedir($dh);
    sort($mu_plugins);
    return $mu_plugins;
}

WordPress Version: 4.0

/**
 * Retrieve an array of must-use plugin files.
 *
 * 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.
 *
 * @since 3.0.0
 * @access private
 *
 * @return array Files to include.
 */
function wp_get_mu_plugins()
{
    $mu_plugins = array();
    if (!is_dir(WPMU_PLUGIN_DIR)) {
        return $mu_plugins;
    }
    if (!$dh = opendir(WPMU_PLUGIN_DIR)) {
        return $mu_plugins;
    }
    while (($plugin = readdir($dh)) !== false) {
        if (substr($plugin, -4) == '.php') {
            $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
        }
    }
    closedir($dh);
    sort($mu_plugins);
    return $mu_plugins;
}

WordPress Version: 3.7

/**
 * Returns array of must-use plugin files to be included in global scope.
 *
 * The default directory is wp-content/mu-plugins. To change the default directory
 * manually, define <code>WPMU_PLUGIN_DIR</code> and <code>WPMU_PLUGIN_URL</code>
 * in wp-config.php.
 *
 * @access private
 * @since 3.0.0
 * @return array Files to include
 */
function wp_get_mu_plugins()
{
    $mu_plugins = array();
    if (!is_dir(WPMU_PLUGIN_DIR)) {
        return $mu_plugins;
    }
    if (!$dh = opendir(WPMU_PLUGIN_DIR)) {
        return $mu_plugins;
    }
    while (($plugin = readdir($dh)) !== false) {
        if (substr($plugin, -4) == '.php') {
            $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
        }
    }
    closedir($dh);
    sort($mu_plugins);
    return $mu_plugins;
}