WP_REST_Attachments_Controller
class WP_REST_Attachments_Controller
// Constructor: function Object() { [native code] } Core controller used to access attachments via the REST API.
Methods 21 methods
| Method / Return | Description |
|---|---|
| register_routes() void | Registers the routes for attachments. |
| prepare_items_query() array | Determines the allowed query_vars for a get_items() response and
Parameters: $prepared_args: mixed, $request: mixed |
| create_item_permissions_check() (true | Checks if a given request has access to create an attachment.
Parameters: $request: mixed |
| create_item() (WP_REST_Response | Creates a single attachment.
Parameters: $request: mixed |
| insert_attachment() (array | Inserts the attachment post in the database. Does not update the attachment meta.
Parameters: $request: mixed |
| handle_featured_media() (bool | Determines the featured media based on a request param.
Parameters: $featured_media: mixed, $post_id: mixed |
| update_item() (WP_REST_Response | Updates a single attachment.
Parameters: $request: mixed |
| post_process_item() (WP_REST_Response | Performs post-processing on an attachment.
Parameters: $request: mixed |
| post_process_item_permissions_check() (true | Checks if a given request can perform post-processing on an attachment.
Parameters: $request: mixed |
| edit_media_item_permissions_check() (true | Checks if a given request has access to editing media.
Parameters: $request: mixed |
| edit_media_item() (WP_REST_Response | Applies edits to a media item and creates a new attachment record.
Parameters: $request: mixed |
| prepare_item_for_database() (stdClass | Prepares a single attachment for create or update.
Parameters: $request: mixed |
| prepare_item_for_response() WP_REST_Response | Prepares a single attachment output for response.
Parameters: $item: mixed, $request: mixed |
| get_item_schema() array | Retrieves the attachment's schema, conforming to JSON Schema. |
| upload_from_data() (array | Handles an upload via raw POST data.
Parameters: $data: mixed, $headers: mixed, $time: mixed |
| get_filename_from_disposition() (string | Parses filename from a Content-Disposition header value.
Parameters: $disposition_header: mixed |
| get_collection_params() array | Retrieves the query params for collections of attachments. |
| upload_from_file() (array | Handles an upload via multipart/form-data ($_FILES).
Parameters: $files: mixed, $headers: mixed, $time: mixed |
| get_media_types() array | Retrieves the supported media types. |
| check_upload_size() (true | Determine if uploaded file exceeds space quota on multisite.
Parameters: $file: mixed |
| get_edit_media_item_args() array | Gets the request args for the edit item route. |
Properties
| Property / Type | Description |
|---|---|
| $allow_batch mixed public | No description available. |