wp_image_file_matches_image_meta
Filters whether an image path or URI matches image meta.
Usage
add_filter( 'wp_image_file_matches_image_meta', 'wp_kama_image_file_matches_meta_filter', 10, 4 );
/**
* Function for `wp_image_file_matches_image_meta` filter-hook.
*
* @param bool $match Whether the image relative path from the image meta matches the end of the URI or path to the image file.
* @param string $image_location Full path or URI to the tested image file.
* @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
* @param int $attachment_id The image attachment ID or 0 if not supplied.
*
* @return bool
*/
function wp_kama_image_file_matches_meta_filter( $match, $image_location, $image_meta, $attachment_id ){
// filter...
return $match;
}
- $match(true|false)
- Whether the image relative path from the image meta matches the end of the URI or path to the image file.
- $image_location(string)
- Full path or URI to the tested image file.
- $image_meta(array)
- The image meta data as returned by 'wp_get_attachment_metadata()'.
- $attachment_id(int)
- The image attachment ID or 0 if not supplied.
Changelog
| Since 5.5.0 | Introduced. |
Where the hook is called
wp_image_file_matches_image_meta
wp-includes/media.php 1701
return apply_filters( 'wp_image_file_matches_image_meta', $match, $image_location, $image_meta, $attachment_id );