# get_default_comment_status()

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

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

## Сигнатура

```php
get_default_comment_status( string $post_type = 'post', string $comment_type = 'comment' ): string
```

## Описание

Получает статус комментариев по умолчанию для типа записи.

## Параметры

- `$post_type` `string` — необязательный, по умолчанию `'post'`. Тип записи. Значение по умолчанию 'post'.
- `$comment_type` `string` — необязательный, по умолчанию `'comment'`. Тип комментария. Значение по умолчанию 'comment'.

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

`string` — 'open' 'closed'

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

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

```php
function get_default_comment_status( $post_type = 'post', $comment_type = 'comment' ) {
	switch ( $comment_type ) {
		case 'pingback':
		case 'trackback':
			$supports = 'trackbacks';
			$option   = 'ping';
			break;
		default:
			$supports = 'comments';
			$option   = 'comment';
			break;
	}

	// Set the status.
	if ( 'page' === $post_type ) {
		$status = 'closed';
	} elseif ( post_type_supports( $post_type, $supports ) ) {
		$status = get_option( "default_{$option}_status" );
	} else {
		$status = 'closed';
	}

	/**
	 * Filters the default comment status for the given post type.
	 *
	 * @since 4.3.0
	 *
	 * @param string $status       Default status for the given post type,
	 *                             either 'open' or 'closed'.
	 * @param string $post_type    Post type. Default is `post`.
	 * @param string $comment_type Type of comment. Default is `comment`.
	 */
	return apply_filters( 'get_default_comment_status', $status, $post_type, $comment_type );
}
```

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

- 4.3.0 — Introduced.

## Связанные

Использует: [`post_type_supports`](https://chugunov.pro/api-wordpress/functions/post_type_supports/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_option`](https://chugunov.pro/api-wordpress/functions/get_option/).
Используется в: [`get_default_post_to_edit`](https://chugunov.pro/api-wordpress/functions/get_default_post_to_edit/), [`wp_insert_post`](https://chugunov.pro/api-wordpress/functions/wp_insert_post/), `wp_xmlrpc_server::mw_editPost`, `wp_xmlrpc_server::mw_newPost`.

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