WP_REST_Comments_Controller::prepare_status_response

Advertisement

Summery Summery

Checks comment_approved to set comment status for single comment output.

Syntax Syntax

WP_REST_Comments_Controller::prepare_status_response( string|int $comment_approved )

Parameters Parameters

$comment_approved

(Required) comment status.

Return Return

(string) Comment status.

Source Source

File: wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

	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;
	}

Advertisement

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.

Advertisement

Leave a Reply