wpseo_image_data
Filter: wpseo_image_data Filter image data.
Elements with keys not listed in the section will be discarded.
Использование
add_filter( 'wpseo_image_data', 'wp_kama_wpseo_image_data_filter', 10, 2 );
/**
* Function for `wpseo_image_data` filter-hook.
*
* @param array $image_data Array of image data
* @param int $attachment_id Attachment ID.
*
* @return array
*/
function wp_kama_wpseo_image_data_filter( $image_data, $attachment_id ){
// filter...
return $image_data;
}
- $image_data(массив)
Array of image data
-
id(int)
Image's ID as an attachment. -
alt(строка)
Image's alt text. -
path(строка)
Image's path. -
width(int)
Width of image. -
height(int)
Height of image. -
pixels(int)
Number of pixels in the image. -
type(строка)
Image's MIME type. -
size(строка)
Image's size. -
url(строка)
Image's URL. - filesize(int)
The file size in bytes, if already set.
-
- $attachment_id(int)
- Attachment ID.
Где вызывается хук
wpseo_image_data
yoast/inc/class-wpseo-image-utils.php 167
$image = apply_filters( 'wpseo_image_data', $image, $attachment_id );