Property | Type | Description | |
---|---|---|---|
$meta | WP_REST_Comment_Meta_Fields | Instance of a comment meta fields object. |
Method | Description | |
---|---|---|
__construct ( ) | Constructor. | |
create_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | Creates a comment. | |
create_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | Checks if a given request has access to create a comment. | |
delete_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | Deletes a comment. | |
delete_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | Checks if a given request has access to delete a comment. | |
get_collection_params ( ) : array | Retrieves the query params for collections. | |
get_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | Retrieves a comment. | |
get_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | Checks if a given request has access to read the comment. | |
get_item_schema ( ) : array | Retrieves the comment's schema, conforming to JSON Schema. | |
get_items ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | Retrieves a list of comment items. | |
get_items_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | Checks if a given request has access to read comments. | |
prepare_item_for_response ( WP_Comment $comment, WP_REST_Request $request ) : WP_REST_Response | Prepares a single comment output for response. | |
register_routes ( ) | Registers the routes for the objects of the controller. | |
update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | Updates a comment. | |
update_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | Checks if a given REST request has access to update a comment. |
Method | Description | |
---|---|---|
check_edit_permission ( object $comment ) : boolean | Checks if a comment can be edited or deleted. | |
check_read_permission ( WP_Comment $comment, WP_REST_Request $request ) : boolean | Checks if the comment can be read. | |
check_read_post_permission ( WP_Post $post, WP_REST_Request $request ) : boolean | Checks if the post can be read. | |
handle_status_param ( string | integer $new_status, integer $comment_id ) : boolean | Sets the comment_status of a given comment object when creating or updating a comment. | |
normalize_query_param ( string $query_param ) : string | Prepends internal property prefix to query parameters to match our response fields. | |
prepare_item_for_database ( WP_REST_Request $request ) : array | WP_Error | Prepares a single comment to be inserted into the database. | |
prepare_links ( WP_Comment $comment ) : array | Prepares links for the request. | |
prepare_status_response ( string | integer $comment_approved ) : string | Checks comment_approved to set comment status for single comment output. |
protected check_edit_permission ( object $comment ) : boolean | ||
$comment | object | Comment object. |
return | boolean | Whether the comment can be edited or deleted. |
protected check_read_permission ( WP_Comment $comment, WP_REST_Request $request ) : boolean | ||
$comment | WP_Comment | Comment object. |
$request | WP_REST_Request | Request data to check. |
return | boolean | Whether the comment can be read. |
protected check_read_post_permission ( WP_Post $post, WP_REST_Request $request ) : boolean | ||
$post | WP_Post | Post object. |
$request | WP_REST_Request | Request data to check. |
return | boolean | Whether post can be read. |
public create_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | WP_REST_Response | Response object on success, or error object on failure. |
public create_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | boolean | True if the request has access to create items, error object otherwise. |
public delete_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | WP_REST_Response | Response object on success, or error object on failure. |
public delete_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | boolean | True if the request has access to delete the item, error object otherwise. |
public get_collection_params ( ) : array | ||
return | array | Comments collection parameters. |
public get_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | WP_REST_Response | Response object on success, or error object on failure. |
public get_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | boolean | True if the request has read access for the item, error object otherwise. |
public get_item_schema ( ) : array | ||
return | array |
public get_items ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | WP_REST_Response | Response object on success, or error object on failure. |
public get_items_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | boolean | True if the request has read access, error object otherwise. |
protected normalize_query_param ( string $query_param ) : string | ||
$query_param | string | Query parameter. |
return | string | The normalized query parameter. |
protected prepare_item_for_database ( WP_REST_Request $request ) : array | WP_Error | ||
$request | WP_REST_Request | Request object. |
return | array | WP_Error | Prepared comment, otherwise WP_Error object. |
public prepare_item_for_response ( WP_Comment $comment, WP_REST_Request $request ) : WP_REST_Response | ||
$comment | WP_Comment | Comment object. |
$request | WP_REST_Request | Request object. |
return | WP_REST_Response | Response object. |
protected prepare_links ( WP_Comment $comment ) : array | ||
$comment | WP_Comment | Comment object. |
return | array | Links for the given comment. |
public register_routes ( ) |
public update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | WP_REST_Response | Response object on success, or error object on failure. |
public update_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_Error | boolean | True if the request has access to update the item, error object otherwise. |