wp_get_active_network_plugins()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
wp_get_active_network_plugins(): string[]
Описание
Каталог по умолчанию — wp-content/plugins. Чтобы изменить каталог по умолчанию вручную, задайте WP_PLUGIN_DIR и WP_PLUGIN_URL в wp-config.php.
Оригинал (английский)
The default directory is wp-content/plugins. To change the default directory manually, define WP_PLUGIN_DIR and WP_PLUGIN_URL in wp-config.php.
Возвращаемое значение
string[]
Исходный код
wp-includes/ms-load.php:37
function wp_get_active_network_plugins() {
$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
if ( empty( $active_plugins ) ) {
return array();
}
$plugins = array();
$active_plugins = array_keys( $active_plugins );
sort( $active_plugins );
foreach ( $active_plugins as $plugin ) {
if ( ! validate_file( $plugin ) // $plugin must validate as file.
&& str_ends_with( $plugin, '.php' ) // $plugin must end with '.php'.
&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist.
) {
$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
}
}
return $plugins;
}
История изменений
| Версия | Описание |
|---|---|
| 3.1.0 | Introduced. |

