WPDev.one
Core Class

WP_REST_Comments_Controller

class WP_REST_Comments_Controller // Constructor: function Object() { [native code] }

Core controller used to access comments via the REST API.

Methods 26 methods

Method / Return Description
__construct()
void

Constructor.

register_routes()
void

Registers the routes for comments.

get_items_permissions_check()
(true

Checks if a given request has access to read comments.

Parameters: $request: mixed
get_items()
(WP_REST_Response

Retrieves a list of comment items.

Parameters: $request: mixed
get_comment()
(WP_Comment

Get the comment, if the ID is valid.

Parameters: $id: mixed
get_item_permissions_check()
(true

Checks if a given request has access to read the comment.

Parameters: $request: mixed
get_item()
(WP_REST_Response

Retrieves a comment.

Parameters: $request: mixed
create_item_permissions_check()
(true

Checks if a given request has access to create a comment.

Parameters: $request: mixed
create_item()
(WP_REST_Response

Creates a comment.

Parameters: $request: mixed
update_item_permissions_check()
(true

Checks if a given REST request has access to update a comment.

Parameters: $request: mixed
update_item()
(WP_REST_Response

Updates a comment.

Parameters: $request: mixed
delete_item_permissions_check()
(true

Checks if a given request has access to delete a comment.

Parameters: $request: mixed
delete_item()
(WP_REST_Response

Deletes a comment.

Parameters: $request: mixed
prepare_item_for_response()
WP_REST_Response

Prepares a single comment output for response.

Parameters: $item: mixed, $request: mixed
prepare_links()
array

Prepares links for the request.

Parameters: $comment: mixed
normalize_query_param()
string

Prepends internal property prefix to query parameters to match our response fields.

Parameters: $query_param: mixed
prepare_status_response()
string

Checks comment_approved to set comment status for single comment output.

Parameters: $comment_approved: mixed
prepare_item_for_database()
(array

Prepares a single comment to be inserted into the database.

Parameters: $request: mixed
get_item_schema()
array

Retrieves the comment's schema, conforming to JSON Schema.

get_collection_params()
array

Retrieves the query params for collections.

handle_status_param()
bool

Sets the comment_status of a given comment object when creating or updating a comment.

Parameters: $new_status: mixed, $comment_id: mixed
check_read_post_permission()
bool

Checks if the post can be read.

Parameters: $post: mixed, $request: mixed
check_read_permission()
bool

Checks if the comment can be read.

Parameters: $comment: mixed, $request: mixed
check_edit_permission()
bool

Checks if a comment can be edited or deleted.

Parameters: $comment: mixed
check_comment_author_email()
(string

Checks a comment author email for validity.

Parameters: $value: mixed, $request: mixed, $param: mixed
check_is_comment_content_allowed()
bool

If empty comments are not allowed, checks if the provided comment content is not empty.

Parameters: $prepared_comment: mixed

Properties

Property / Type Description
$meta
mixed
public
No description available.

Class Information

Since Version
4.7.0
Source File
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
Advertisement