wp_get_mu_plugins

函数


wp_get_mu_plugins ( No parameters )
Access
Private
返回值
  • (string[]) Array of absolute paths of files to include.
定义位置
  • wp-includes/load.php
    , line 802
引入
3.0.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.

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;
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。