WP_REST_Comments_Controller::prepare_status_response
Checks comment_approved to set comment status for single comment output.
Method of the class: WP_REST_Comments_Controller{}
No Hooks.
Returns
String. Comment status.
Usage
// protected - for code of main (parent) or child class $result = $this->prepare_status_response( $comment_approved );
- $comment_approved(string) (required)
- Comment status.
Changelog
| Since 4.7.0 | Introduced. |
WP_REST_Comments_Controller::prepare_status_response() WP REST Comments Controller::prepare status response code WP 6.9.1
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;
}