# wp_check_comment_disallowed_list()

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

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

## Сигнатура

```php
wp_check_comment_disallowed_list( string $author, string $email, string $url, string $comment, string $user_ip, string $user_agent ): bool
```

## Описание

Проверяет, содержит ли комментарий запрещённые символы или слова.

## Параметры

- `$author` `string` — обязательный. Автор комментария.
- `$email` `string` — обязательный. Электронная почта комментария.
- `$url` `string` — обязательный. URL, использованный в комментарии.
- `$comment` `string` — обязательный. Содержимое комментария.
- `$user_ip` `string` — обязательный. IP-адрес автора комментария.
- `$user_agent` `string` — обязательный. User agent браузера автора.

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

`bool`

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

Файл: `wp-includes/comment.php:1365`

```php
function wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ) {
	/**
	 * Fires before the comment is tested for disallowed characters or words.
	 *
	 * @since 1.5.0
	 * @deprecated 5.5.0 Use 'wp_check_comment_disallowed_list' instead.
	 *
	 * @param string $author     Comment author.
	 * @param string $email      Comment author's email.
	 * @param string $url        Comment author's URL.
	 * @param string $comment    Comment content.
	 * @param string $user_ip    Comment author's IP address.
	 * @param string $user_agent Comment author's browser user agent.
	 */
	do_action_deprecated(
		'wp_blacklist_check',
		array( $author, $email, $url, $comment, $user_ip, $user_agent ),
		'5.5.0',
		'wp_check_comment_disallowed_list',
		__( 'Please consider writing more inclusive code.' )
	);

	/**
	 * Fires before the comment is tested for disallowed characters or words.
	 *
	 * @since 5.5.0
	 *
	 * @param string $author     Comment author.
	 * @param string $email      Comment author's email.
	 * @param string $url        Comment author's URL.
	 * @param string $comment    Comment content.
	 * @param string $user_ip    Comment author's IP address.
	 * @param string $user_agent Comment author's browser user agent.
	 */
	do_action( 'wp_check_comment_disallowed_list', $author, $email, $url, $comment, $user_ip, $user_agent );

	$mod_keys = trim( get_option( 'disallowed_keys' ) );
	if ( '' === $mod_keys ) {
		return false; // If moderation keys are empty.
	}

	// Ensure HTML tags are not being used to bypass the list of disallowed characters and words.
	$comment_without_html = wp_strip_all_tags( $comment );

	$words = explode( "\n", $mod_keys );

	foreach ( (array) $words as $word ) {
		$word = trim( $word );

		// Skip empty lines.
		if ( empty( $word ) ) {
			continue; }

		// Do some escaping magic so that '#' chars in the spam words don't break things:
		$word = preg_quote( $word, '#' );

		$pattern = "#$word#iu";
		if ( preg_match( $pattern, $author )
			|| preg_match( $pattern, $email )
			|| preg_match( $pattern, $url )
			|| preg_match( $pattern, $comment )
			|| preg_match( $pattern, $comment_without_html )
			|| preg_match( $pattern, $user_ip )
			|| preg_match( $pattern, $user_agent )
		) {
			return true;
		}
	}
	return false;
}
```

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

- 5.5.0 — Introduced.

## Связанные

Использует: [`do_action_deprecated`](https://chugunov.pro/api-wordpress/functions/do_action_deprecated/), [`wp_strip_all_tags`](https://chugunov.pro/api-wordpress/functions/wp_strip_all_tags/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`do_action`](https://chugunov.pro/api-wordpress/functions/do_action/), [`get_option`](https://chugunov.pro/api-wordpress/functions/get_option/).
Используется в: [`wp_check_comment_data`](https://chugunov.pro/api-wordpress/functions/wp_check_comment_data/), [`wp_blacklist_check`](https://chugunov.pro/api-wordpress/functions/wp_blacklist_check/).

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