WP_REST_Comments_Controller::prepare_status_response()protectedWP 4.7.0

Checks comment_approved to set comment status for single comment output.

Метод класса: WP_REST_Comments_Controller{}

Хуков нет.

Возвращает

Строку. Comment status.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->prepare_status_response( $comment_approved );
$comment_approved(строка|int) (обязательный)
comment status.

Список изменений

С версии 4.7.0 Введена.

Код WP_REST_Comments_Controller::prepare_status_response() WP 6.5.2

protected function prepare_status_response( $comment_approved ) {

	switch ( $comment_approved ) {
		case 'hold':
		case '0':
			$status = 'hold';
			break;

		case 'approve':
		case '1':
			$status = 'approved';
			break;

		case 'spam':
		case 'trash':
		default:
			$status = $comment_approved;
			break;
	}

	return $status;
}