# wp_deregister_script()

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

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

## Сигнатура

```php
wp_deregister_script( string $handle )
```

## Описание

Note: there are intentional safeguards in place to prevent critical admin scripts, such as jQuery core, from being unregistered.[See also](#see-also)
- [WP_Dependencies::remove()](https://developer.wordpress.org/reference/classes/WP_Dependencies/remove/)

## Параметры

- `$handle` `string` — обязательный. Имя удаляемого скрипта.

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

Файл: `wp-includes/functions-wp-scripts.php:367`

```php
function wp_deregister_script( $handle ) {
	global $pagenow;

	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );

	/**
	 * Do not allow accidental or negligent de-registering of critical scripts in the admin.
	 * Show minimal remorse if the correct hook is used.
	 */
	$current_filter = current_filter();
	if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) ||
		( 'wp-login.php' === $pagenow && 'login_enqueue_scripts' !== $current_filter )
	) {
		$not_allowed = array(
			'jquery',
			'jquery-core',
			'jquery-migrate',
			'jquery-ui-core',
			'jquery-ui-accordion',
			'jquery-ui-autocomplete',
			'jquery-ui-button',
			'jquery-ui-datepicker',
			'jquery-ui-dialog',
			'jquery-ui-draggable',
			'jquery-ui-droppable',
			'jquery-ui-menu',
			'jquery-ui-mouse',
			'jquery-ui-position',
			'jquery-ui-progressbar',
			'jquery-ui-resizable',
			'jquery-ui-selectable',
			'jquery-ui-slider',
			'jquery-ui-sortable',
			'jquery-ui-spinner',
			'jquery-ui-tabs',
			'jquery-ui-tooltip',
			'jquery-ui-widget',
			'underscore',
			'backbone',
		);

		if ( in_array( $handle, $not_allowed, true ) ) {
			_doing_it_wrong(
				__FUNCTION__,
				sprintf(
					/* translators: 1: Script name, 2: wp_enqueue_scripts */
					__( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ),
					"<code>$handle</code>",
					'<code>wp_enqueue_scripts</code>'
				),
				'3.6.0'
			);
			return;
		}
	}

	wp_scripts()->remove( $handle );
}
```

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

- 2.1.0 — Introduced.

## Связанные

Использует: [`wp_scripts`](https://chugunov.pro/api-wordpress/functions/wp_scripts/), [`current_filter`](https://chugunov.pro/api-wordpress/functions/current_filter/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`is_admin`](https://chugunov.pro/api-wordpress/functions/is_admin/), [`_doing_it_wrong`](https://chugunov.pro/api-wordpress/functions/_doing_it_wrong/).

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