Méthode | Description | |
---|---|---|
create_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | Creates a single attachment. | |
create_item_permissions_check ( WP_REST_Request $request ) : WP_Error | true | Checks if a given request has access to create an attachment. | |
get_collection_params ( ) : array | Retrieves the query params for collections of attachments. | |
get_filename_from_disposition ( string[] $disposition_header ) : string | null | Parses filename from a Content-Disposition header value. | |
get_item_schema ( ) : array | Retrieves the attachment's schema, conforming to JSON Schema. | |
prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response | Prepares a single attachment output for response. | |
update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | Updates a single attachment. | |
validate_user_can_query_private_statuses ( mixed $value, WP_REST_Request $request, string $parameter ) : WP_Error | boolean | Validates whether the user can query private statuses. |
Méthode | Description | |
---|---|---|
get_media_types ( ) : array | Retrieves the supported media types. | |
prepare_item_for_database ( WP_REST_Request $request ) : WP_Error | stdClass | Prepares a single attachment 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 for WP_Query. | |
upload_from_data ( array $data, array $headers ) : array | WP_Error | Handles an upload via raw POST data. | |
upload_from_file ( array $files, array $headers ) : array | WP_Error | Handles an upload via multipart/form-data ($_FILES). |
public create_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | ||
$request | WP_REST_Request | Full details about the request. |
Résultat | WP_Error | WP_REST_Response | Response object on success, WP_Error object on failure. |
public create_item_permissions_check ( WP_REST_Request $request ) : WP_Error | true | ||
$request | WP_REST_Request | Full details about the request. |
Résultat | WP_Error | true | Boolean true if the attachment may be created, or a WP_Error if not. |
public get_collection_params ( ) : array | ||
Résultat | array | Query parameters for the attachment collection as an array. |
public static get_filename_from_disposition ( string[] $disposition_header ) : string | null | ||
$disposition_header | string[] | List of Content-Disposition header values. |
Résultat | string | null | Filename if available, or null if not found. |
public get_item_schema ( ) : array | ||
Résultat | array | Item schema as an array. |
protected get_media_types ( ) : array | ||
Résultat | array | Array of supported media types. |
protected prepare_item_for_database ( WP_REST_Request $request ) : WP_Error | stdClass | ||
$request | WP_REST_Request | Request object. |
Résultat | WP_Error | stdClass | $prepared_attachment Post object. |
public prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response | ||
$post | WP_Post | Attachment object. |
$request | WP_REST_Request | Request object. |
Résultat | WP_REST_Response | Response object. |
protected prepare_items_query ( array $prepared_args = [], WP_REST_Request $request = null ) : array | ||
$prepared_args | array | Optional. Array of prepared arguments. Default empty array. |
$request | WP_REST_Request | Optional. Request to prepare items for. |
Résultat | array | Array of query arguments. |
public update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response | ||
$request | WP_REST_Request | Full details about the request. |
Résultat | WP_Error | WP_REST_Response | Response object on success, WP_Error object on failure. |
public validate_user_can_query_private_statuses ( mixed $value, WP_REST_Request $request, string $parameter ) : WP_Error | boolean | ||
$value | mixed | Status value. |
$request | WP_REST_Request | Request object. |
$parameter | string | Additional parameter to pass for validation. |
Résultat | WP_Error | boolean | True if the user may query, WP_Error if not. |