# comments_open()

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

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

## Сигнатура

```php
comments_open( int|WP_Post $post = null ): bool
```

## Описание

Дополнительные сведения об этой и похожих функциях темы см. в статье о Conditional Tags в Theme Developer Handbook.

## Параметры

- `$post` `int|WP_Post` — необязательный, по умолчанию `null`. ID записи или объект WP_Post. По умолчанию — текущая запись.

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

`bool`

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

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

```php
function comments_open( $post = null ) {
	$_post = get_post( $post );

	$post_id       = $_post ? $_post->ID : 0;
	$comments_open = ( $_post && ( 'open' === $_post->comment_status ) );

	/**
	 * Filters whether the current post is open for comments.
	 *
	 * @since 2.5.0
	 *
	 * @param bool $comments_open Whether the current post is open for comments.
	 * @param int  $post_id       The post ID.
	 */
	return apply_filters( 'comments_open', $comments_open, $post_id );
}
```

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

- 1.5.0 — Introduced.

## Связанные

Использует: [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_post`](https://chugunov.pro/api-wordpress/functions/get_post/).
Используется в: [`register_and_do_post_meta_boxes`](https://chugunov.pro/api-wordpress/functions/register_and_do_post_meta_boxes/), `WP_REST_Comments_Controller::create_item_permissions_check`, [`print_embed_comments_button`](https://chugunov.pro/api-wordpress/functions/print_embed_comments_button/), [`wp_handle_comment_submission`](https://chugunov.pro/api-wordpress/functions/wp_handle_comment_submission/), [`feed_links_extra`](https://chugunov.pro/api-wordpress/functions/feed_links_extra/), `wp_xmlrpc_server::wp_newComment`, `wp_xmlrpc_server::_prepare_page`, [`get_post_reply_link`](https://chugunov.pro/api-wordpress/functions/get_post_reply_link/), [`comment_form`](https://chugunov.pro/api-wordpress/functions/comment_form/), [`comments_popup_link`](https://chugunov.pro/api-wordpress/functions/comments_popup_link/), [`get_comment_reply_link`](https://chugunov.pro/api-wordpress/functions/get_comment_reply_link/).

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