Summery Summery
Prepares a single attachment for create or update.
Syntax Syntax
Parameters Parameters
- $request
-
(Required) Request object.
Return Return
(stdClass|WP_Error) Post object.
Source Source
File: wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
* @since 5.5.0 * * @param WP_REST_Request $request Full details about the request. * @return true|WP_Error True if the request has read access, WP_Error object otherwise. */ public function edit_media_item_permissions_check( $request ) { if ( ! current_user_can( 'upload_files' ) ) { return new WP_Error( 'rest_cannot_edit_image', __( 'Sorry, you are not allowed to upload media on this site.' ), array( 'status' => rest_authorization_required_code() ) ); } return $this->update_item_permissions_check( $request ); } /** * Applies edits to a media item and creates a new attachment record. * * @since 5.5.0 * * @param WP_REST_Request $request Full details about the request. * @return WP_REST_Response|WP_Error Response object on success, WP_Error object on failure. */ public function edit_media_item( $request ) { require_once ABSPATH . 'wp-admin/includes/image.php';
Advertisement
Changelog Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |