wp_get_mu_plugins

函数
wp_get_mu_plugins ( No parameters )
Access
Private
返回值
  • (string[]) Array of absolute paths of files to include.
定义位置
相关方法
get_mu_pluginsget_pluginswp_get_linkswp_get_plugin_errorwp_update_plugins
引入
3.0.0
弃用
-

wp_get_mu_plugins: 这个函数检索一个必须使用的插件列表。它不接受任何参数,并返回一个插件文件路径的数组。

检索一个必须使用的插件文件阵列。

默认目录是wp-content/mu-plugins。要手动改变默认目录,请在wp-config.php中定义`WPMU_PLUGIN_DIR`和`WPMU_PLUGIN_URL`。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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;
}
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; }
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;
}

常见问题

FAQs
查看更多 >