# wp_get_active_and_valid_plugins()

URL: https://chugunov.pro/api-wordpress/functions/wp_get_active_and_valid_plugins/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 3.0.0.

## Сигнатура

```php
wp_get_active_and_valid_plugins(): string[]
```

## Описание

Во время обновления или установки WordPress плагины не возвращаются.
Каталог по умолчанию — wp-content/plugins. Чтобы изменить каталог по умолчанию вручную, определите WP_PLUGIN_DIR и WP_PLUGIN_URL в wp-config.php.

## Возвращаемое значение

`string[]`

## Исходный код

Файл: `wp-includes/load.php:1013`

```php
function wp_get_active_and_valid_plugins() {
	$plugins        = array();
	$active_plugins = (array) get_option( 'active_plugins', array() );

	// Check for hacks file if the option is enabled.
	if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
		_deprecated_file( 'my-hacks.php', '1.5.0' );
		array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
	}

	if ( empty( $active_plugins ) || wp_installing() ) {
		return $plugins;
	}

	$network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;

	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.
			// Not already included as a network plugin.
			&& ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins, true ) )
		) {
			$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
		}
	}

	/*
	 * Remove plugins from the list of active plugins when we're on an endpoint
	 * that should be protected against WSODs and the plugin is paused.
	 */
	if ( wp_is_recovery_mode() ) {
		$plugins = wp_skip_paused_plugins( $plugins );
	}

	return $plugins;
}
```

## История изменений

- 3.0.0 — Introduced.

## Связанные

Использует: [`wp_is_recovery_mode`](https://chugunov.pro/api-wordpress/functions/wp_is_recovery_mode/), [`wp_skip_paused_plugins`](https://chugunov.pro/api-wordpress/functions/wp_skip_paused_plugins/), [`wp_installing`](https://chugunov.pro/api-wordpress/functions/wp_installing/), [`_deprecated_file`](https://chugunov.pro/api-wordpress/functions/_deprecated_file/), [`validate_file`](https://chugunov.pro/api-wordpress/functions/validate_file/), [`wp_get_active_network_plugins`](https://chugunov.pro/api-wordpress/functions/wp_get_active_network_plugins/), [`is_multisite`](https://chugunov.pro/api-wordpress/functions/is_multisite/), [`get_option`](https://chugunov.pro/api-wordpress/functions/get_option/).
Используется в: `WP_REST_Templates_Controller::get_wp_templates_author_text_field`.

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/wp_get_active_and_valid_plugins/
