wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_get_mu_plugins › WordPress Function

Since3.0.0
已弃用n/a
wp_get_mu_plugins ( 没有参数 )
访问:
  • private
返回:
  • (string[]) Array of absolute paths of files to include.
定义在:
文档:

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.


源码

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;
}