wp_image_file_matches_image_meta
Filter HookDescription
Filters whether an image path or URI matches image meta.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1687 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$match
|
Whether the image relative path from the image meta matches the end of the URI or path to the image file. |
string
|
$image_location
|
Full path or URI to the tested image file. |
array
|
$image_meta
|
The image meta data as returned by 'wp_get_attachment_metadata()'. |
int
|
$attachment_id
|
The image attachment ID or 0 if not supplied. |
Usage Examples
Basic Usage
<?php
// Hook into wp_image_file_matches_image_meta
add_filter('wp_image_file_matches_image_meta', 'my_custom_filter', 10, 4);
function my_custom_filter($match, $image_location, $image_meta, $attachment_id) {
// Your custom filtering logic here
return $match;
}
Source Code Context
wp-includes/media.php:1687
- How this hook is used in WordPress core
<?php
1682 * matches the end of the URI or path to the image file.
1683 * @param string $image_location Full path or URI to the tested image file.
1684 * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
1685 * @param int $attachment_id The image attachment ID or 0 if not supplied.
1686 */
1687 return apply_filters( 'wp_image_file_matches_image_meta', $match, $image_location, $image_meta, $attachment_id );
1688 }
1689
1690 /**
1691 * Determines an image's width and height dimensions based on the source file.
1692 *
PHP Documentation
<?php
/**
* Filters whether an image path or URI matches image meta.
*
* @since 5.5.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.