# _deprecated_argument()

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

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

> Устаревший элемент. Помечен устаревшим с версии 5.4.0.

## Сигнатура

```php
_deprecated_argument( string $function_name, string $version, string $message = '' )
```

## Описание

Эту функцию следует использовать всякий раз, когда используется устаревший аргумент функции.
Перед вызовом этой функции нужно проверить, был ли аргумент использован, сравнив его со значением по умолчанию или оценив, пуст ли он.
Например:
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '3.0.0' );
}Существует хук 'deprecated_argument_run', который будет вызван и с помощью которого можно получить трассировку вплоть до того, какой файл и функция использовали устаревший аргумент.
Текущее поведение — сгенерировать пользовательскую ошибку, если WP_DEBUG равно true.

## Параметры

- `$function_name` `string` — обязательный. Функция, которая была вызвана.
- `$version` `string` — обязательный. Версия WordPress, в которой использованный аргумент стал устаревшим.
- `$message` `string` — необязательный, по умолчанию `''`. Сообщение об изменении.

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

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

```php
function _deprecated_argument( $function_name, $version, $message = '' ) {

	/**
	 * Fires when a deprecated argument is called.
	 *
	 * @since 3.0.0
	 *
	 * @param string $function_name The function that was called.
	 * @param string $message       A message regarding the change.
	 * @param string $version       The version of WordPress that deprecated the argument used.
	 */
	do_action( 'deprecated_argument_run', $function_name, $message, $version );

	/**
	 * Filters whether to trigger an error for deprecated arguments.
	 *
	 * @since 3.0.0
	 *
	 * @param bool $trigger Whether to trigger the error for deprecated arguments. Default true.
	 */
	if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
		if ( function_exists( '__' ) ) {
			if ( $message ) {
				$message = sprintf(
					/* translators: 1: PHP function name, 2: Version number, 3: Optional message regarding the change. */
					__( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s' ),
					$function_name,
					$version,
					$message
				);
			} else {
				$message = sprintf(
					/* translators: 1: PHP function name, 2: Version number. */
					__( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
					$function_name,
					$version
				);
			}
		} else {
			if ( $message ) {
				$message = sprintf(
					'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s',
					$function_name,
					$version,
					$message
				);
			} else {
				$message = sprintf(
					'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.',
					$function_name,
					$version
				);
			}
		}

		wp_trigger_error( '', $message, E_USER_DEPRECATED );
	}
}
```

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

- 5.4.0 — The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
- 3.0.0 — Introduced.

## Связанные

Использует: [`wp_trigger_error`](https://chugunov.pro/api-wordpress/functions/wp_trigger_error/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`do_action`](https://chugunov.pro/api-wordpress/functions/do_action/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: [`inject_ignored_hooked_blocks_metadata_attributes`](https://chugunov.pro/api-wordpress/functions/inject_ignored_hooked_blocks_metadata_attributes/), [`_load_remote_block_patterns`](https://chugunov.pro/api-wordpress/functions/_load_remote_block_patterns/), `WP_Theme_JSON_Resolver::get_theme_data`, `WP_Theme_JSON_Resolver::get_merged_data`, `WP_Theme_JSON::get_stylesheet`, [`wp_get_environment_type`](https://chugunov.pro/api-wordpress/functions/wp_get_environment_type/), `WP_User::__unset`, [`update_user_status`](https://chugunov.pro/api-wordpress/functions/update_user_status/), [`wp_save_image_file`](https://chugunov.pro/api-wordpress/functions/wp_save_image_file/), [`image_edit_apply_changes`](https://chugunov.pro/api-wordpress/functions/image_edit_apply_changes/), [`wp_stream_image`](https://chugunov.pro/api-wordpress/functions/wp_stream_image/), [`WP_Image_Editor`](https://chugunov.pro/api-wordpress/functions/wp_image_editor/), [`wp_install`](https://chugunov.pro/api-wordpress/functions/wp_install/), [`register_setting`](https://chugunov.pro/api-wordpress/functions/register_setting/), [`unregister_setting`](https://chugunov.pro/api-wordpress/functions/unregister_setting/), [`get_plugin_data`](https://chugunov.pro/api-wordpress/functions/get_plugin_data/), [`add_settings_field`](https://chugunov.pro/api-wordpress/functions/add_settings_field/), [`add_settings_section`](https://chugunov.pro/api-wordpress/functions/add_settings_section/), [`xfn_check`](https://chugunov.pro/api-wordpress/functions/xfn_check/), `WP_User::has_cap`, `WP_User::__isset`, `WP_User::__get`, `WP_User::__set`, [`wp_clear_scheduled_hook`](https://chugunov.pro/api-wordpress/functions/wp_clear_scheduled_hook/), [`get_category_parents`](https://chugunov.pro/api-wordpress/functions/get_category_parents/), [`wp_dropdown_categories`](https://chugunov.pro/api-wordpress/functions/wp_dropdown_categories/), [`load_plugin_textdomain`](https://chugunov.pro/api-wordpress/functions/load_plugin_textdomain/), [`is_email`](https://chugunov.pro/api-wordpress/functions/is_email/), [`convert_chars`](https://chugunov.pro/api-wordpress/functions/convert_chars/), [`wp_new_user_notification`](https://chugunov.pro/api-wordpress/functions/wp_new_user_notification/), [`wp_notify_postauthor`](https://chugunov.pro/api-wordpress/functions/wp_notify_postauthor/), [`get_bloginfo`](https://chugunov.pro/api-wordpress/functions/get_bloginfo/), [`safecss_filter_attr`](https://chugunov.pro/api-wordpress/functions/safecss_filter_attr/), `WP_Query::get_posts`, [`get_categories`](https://chugunov.pro/api-wordpress/functions/get_categories/), [`wp_upload_bits`](https://chugunov.pro/api-wordpress/functions/wp_upload_bits/), [`wp_get_http_headers`](https://chugunov.pro/api-wordpress/functions/wp_get_http_headers/), [`get_adjacent_post`](https://chugunov.pro/api-wordpress/functions/get_adjacent_post/), [`get_delete_post_link`](https://chugunov.pro/api-wordpress/functions/get_delete_post_link/), `WP_Admin_Bar::add_node`.

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