wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php:17Core controller used to access attachments via the REST API.
Every hook that fires from inside WP_REST_Attachments_Controller, in the order it appears in the class, grouped by the method that fires it.
$allow_batchfalseprotectedclass WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { /** * Whether the controller supports batching. * * @since 5.9.0 * @var false */ protected $allow_batch = false; /** * Registers the routes for attachments. * * @since 5.3.0 * * @see register_rest_route() */ public function register_routes() { parent::register_routes(); register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)/post-process', array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'post_process_item' ), 'permission_callback' => array( $this, 'post_process_item_permissions_check' ), 'args' => array( 'id' => array( 'description' => __( 'Unique identifier for the attachment.' ), 'type' => 'integer', ), 'action' => array( 'type' => 'string', 'enum' => array( 'create-image-subsizes' ), 'required' => true, ), ), ) ); register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)/edit', array( 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'edit_media_item' ), 'permission_callback' => array( $this, 'edit_media_item_permissions_check' ), 'args' => $this->get_edit_media_item_args(), ) ); } /** * Determines the allowed query_vars for a get_items() response and * prepares for WP_Query. * * @since 4.7.0 * @since 6.9.0 Extends the `media_type` and `mime_type` request arguments to support array values. * * @param array $prepared_args Optional. Array of prepared arguments. Default empty array. * @param WP_REST_Request $request Optional. Request to prepare items for. * @return array Array of query arguments. */ protected function prepare_items_query( $prepared_args = array(), $request = null ) { $query_args = parent::prepare_items_query( $prepared_args, $request ); if ( empty( $query_args['post_status'] ) ) { $query_args['post_status'] = 'inherit'; } $all_mime_types = array(); $media_types = $this->get_media_types(); if ( ! empty( $request['media_type'] ) && is_array( $request['media_type'] ) ) { foreach ( $request['media_type'] as $type ) { if ( isset( $media_types[ $type ] ) ) { $all_mime_types = array_merge( $all_mime_types, $media_types[ $type ] ); } } }Introduced in 4.7.0. 17 changes between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
get_endpoint_args_for_item_schema() added.verified against sourcecreate_item_from_url() added.verified against sourceremove_client_side_media_processing_filters() added.verified against sourcesideload_item_permissions_check() added.verified against sourcevalidate_image_size_names() added.verified against sourceget_special_image_sizes() added.verified against sourcevalidate_image_dimensions() added.verified against sourcedimension_exceeds_max() added.verified against sourcesideload_item() added.verified against sourcefilter_wp_unique_filename() added.verified against sourcevalidate_sub_size_provenance() added.verified against sourceget_sideloaded_file_names() added.verified against sourceget_attachment_upload_subdir() added.verified against sourcefinalize_item() added.verified against sourceget_attachment_filename() added.verified against sourceget_attachment_filesize() added.verified against sourceprepare_links() added.verified against sourcesrc/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.