wp_edited_image_metadata
Filter HookDescription
Filters the meta data for the new image created by editing an existing image.Hook Information
File Location |
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
View on GitHub
|
Hook Type | Filter |
Line Number | 793 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$new_image_meta
|
Meta data for the new image. |
int
|
$new_attachment_id
|
Attachment post ID for the new image. |
int
|
$attachment_id
|
Attachment post ID for the edited (parent) image. |
Usage Examples
Basic Usage
<?php
// Hook into wp_edited_image_metadata
add_filter('wp_edited_image_metadata', 'my_custom_filter', 10, 3);
function my_custom_filter($new_image_meta, $new_attachment_id, $attachment_id) {
// Your custom filtering logic here
return $new_image_meta;
}
Source Code Context
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php:793
- How this hook is used in WordPress core
<?php
788 *
789 * @param array $new_image_meta Meta data for the new image.
790 * @param int $new_attachment_id Attachment post ID for the new image.
791 * @param int $attachment_id Attachment post ID for the edited (parent) image.
792 */
793 $new_image_meta = apply_filters( 'wp_edited_image_metadata', $new_image_meta, $new_attachment_id, $attachment_id );
794
795 wp_update_attachment_metadata( $new_attachment_id, $new_image_meta );
796
797 $response = $this->prepare_item_for_response( get_post( $new_attachment_id ), $request );
798 $response->set_status( 201 );
PHP Documentation
<?php
/**
* Filters the meta data for the new image created by editing an existing image.
*
* @since 5.5.0
*
* @param array $new_image_meta Meta data for the new image.
* @param int $new_attachment_id Attachment post ID for the new image.
* @param int $attachment_id Attachment post ID for the edited (parent) image.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
Related Hooks
Related hooks will be displayed here in future updates.