Property | Type | Description | |
---|---|---|---|
$meta | WP_REST_Post_Meta_Fields | Instance of a post meta fields object. | |
$post_type | string | Post type. |
Method | Description | |
---|---|---|
__construct ( string $post_type ) | Constructor. | |
can_access_password_content ( WP_Post $post, WP_REST_Request $request ) : boolean | Checks if the user can access password-protected content. | |
check_read_permission ( object $post ) : boolean | Checks if a post can be read. | |
create_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | Creates a single post. | |
create_item_permissions_check ( WP_REST_Request $request ) : true | WP_Error | Checks if a given request has access to create a post. | |
delete_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | Deletes a single post. | |
delete_item_permissions_check ( WP_REST_Request $request ) : true | WP_Error | Checks if a given request has access to delete a post. | |
get_collection_params ( ) : array | Retrieves the query params for the posts collection. | |
get_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | Retrieves a single post. | |
get_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error | Checks if a given request has access to read a post. | |
get_item_schema ( ) : array | Retrieves the post's schema, conforming to JSON Schema. | |
get_items ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | Retrieves a collection of posts. | |
get_items_permissions_check ( WP_REST_Request $request ) : true | WP_Error | Checks if a given request has access to read posts. | |
handle_template ( string $template, integer $post_id ) | Sets the template for a post. | |
prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response | Prepares a single post output for response. | |
protected_title_format ( ) : string | Overwrites the default protected title format. | |
register_routes ( ) | Registers the routes for the objects of the controller. | |
sanitize_post_statuses ( string | array $statuses, WP_REST_Request $request, string $parameter ) : array | WP_Error | Sanitizes and validates the list of post statuses, including whether the user can query private statuses. | |
update_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | Updates a single post. | |
update_item_permissions_check ( WP_REST_Request $request ) : true | WP_Error | Checks if a given request has access to update a post. |
Method | Description | |
---|---|---|
check_assign_terms_permission ( WP_REST_Request $request ) : boolean | Checks whether current user can assign all terms sent with the current request. | |
check_create_permission ( object $post ) : boolean | Checks if a post can be created. | |
check_delete_permission ( object $post ) : boolean | Checks if a post can be deleted. | |
check_is_post_type_allowed ( object | string $post_type ) : boolean | Checks if a given post type can be viewed or managed. | |
check_update_permission ( object $post ) : boolean | Checks if a post can be edited. | |
handle_featured_media ( integer $featured_media, integer $post_id ) : boolean | WP_Error | Determines the featured media based on a request param. | |
handle_status_param ( string $post_status, object $post_type ) : string | WP_Error | Determines validity and normalizes the given status parameter. | |
handle_terms ( integer $post_id, WP_REST_Request $request ) : null | WP_Error | Updates the post's terms from a REST request. | |
prepare_date_response ( string $date_gmt, string | null $date = null ) : string | null | Checks the post_date_gmt or modified_gmt and prepare any post or modified date for single post output. | |
prepare_item_for_database ( WP_REST_Request $request ) : stdClass | WP_Error | Prepares a single post for create or update. | |
prepare_items_query ( array $prepared_args = [], WP_REST_Request $request = null ) : array | Determines the allowed query_vars for a get_items() response and prepares them for WP_Query. | |
prepare_links ( WP_Post $post ) : array | Prepares links for the request. |
public __construct ( string $post_type ) | ||
$post_type | string | Post type. |
public can_access_password_content ( WP_Post $post, WP_REST_Request $request ) : boolean | ||
$post | WP_Post | Post to check against. |
$request | WP_REST_Request | Request data to check. |
return | boolean | True if the user can access password-protected content, otherwise false. |
protected check_assign_terms_permission ( WP_REST_Request $request ) : boolean | ||
$request | WP_REST_Request | The request object with post and terms data. |
return | boolean | Whether the current user can assign the provided terms. |
protected check_create_permission ( object $post ) : boolean | ||
$post | object | Post object. |
return | boolean | Whether the post can be created. |
protected check_delete_permission ( object $post ) : boolean | ||
$post | object | Post object. |
return | boolean | Whether the post can be deleted. |
public check_read_permission ( object $post ) : boolean | ||
$post | object | Post object. |
return | boolean | Whether the post can be read. |
protected check_update_permission ( object $post ) : boolean | ||
$post | object | Post object. |
return | boolean | Whether the post can be edited. |
public create_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_REST_Response | WP_Error | Response object on success, or WP_Error object on failure. |
public create_item_permissions_check ( WP_REST_Request $request ) : true | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | true | WP_Error | True if the request has access to create items, WP_Error object otherwise. |
public delete_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_REST_Response | WP_Error | Response object on success, or WP_Error object on failure. |
public delete_item_permissions_check ( WP_REST_Request $request ) : true | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | true | WP_Error | True if the request has access to delete the item, WP_Error object otherwise. |
public get_collection_params ( ) : array | ||
return | array | Collection parameters. |
public get_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_REST_Response | WP_Error | Response object on success, or WP_Error object on failure. |
public get_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | boolean | WP_Error | True if the request has read access for the item, WP_Error object otherwise. |
public get_item_schema ( ) : array | ||
return | array | Item schema data. |
public get_items ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_REST_Response | WP_Error | Response object on success, or WP_Error object on failure. |
public get_items_permissions_check ( WP_REST_Request $request ) : true | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | true | WP_Error | True if the request has read access, WP_Error object otherwise. |
public handle_template ( string $template, integer $post_id ) | ||
$template | string | Page template filename. |
$post_id | integer | Post ID. |
protected handle_terms ( integer $post_id, WP_REST_Request $request ) : null | WP_Error | ||
$post_id | integer | The post ID to update the terms form. |
$request | WP_REST_Request | The request object with post and terms data. |
return | null | WP_Error | WP_Error on an error assigning any of the terms, otherwise null. |
protected prepare_item_for_database ( WP_REST_Request $request ) : stdClass | WP_Error | ||
$request | WP_REST_Request | Request object. |
return | stdClass | WP_Error | Post object or WP_Error. |
public prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response | ||
$post | WP_Post | Post object. |
$request | WP_REST_Request | Request object. |
return | WP_REST_Response | Response object. |
protected prepare_items_query ( array $prepared_args = [], WP_REST_Request $request = null ) : array | ||
$prepared_args | array | Optional. Prepared WP_Query arguments. Default empty array. |
$request | WP_REST_Request | Optional. Full details about the request. |
return | array | Items query arguments. |
protected prepare_links ( WP_Post $post ) : array | ||
$post | WP_Post | Post object. |
return | array | Links for the given post. |
public protected_title_format ( ) : string | ||
return | string | Protected title format. |
public register_routes ( ) |
public sanitize_post_statuses ( string | array $statuses, WP_REST_Request $request, string $parameter ) : array | WP_Error | ||
$statuses | string | array | One or more post statuses. |
$request | WP_REST_Request | Full details about the request. |
$parameter | string | Additional parameter to pass to validation. |
return | array | WP_Error | A list of valid statuses, otherwise WP_Error object. |
public update_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | WP_REST_Response | WP_Error | Response object on success, or WP_Error object on failure. |
public update_item_permissions_check ( WP_REST_Request $request ) : true | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
return | true | WP_Error | True if the request has access to update the item, WP_Error object otherwise. |
protected WP_REST_Post_Meta_Fields $meta | ||
return | WP_REST_Post_Meta_Fields |