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
檢視更多 >