wpseo_image_data хук-фильтрYoast 1.0

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 int   $image         Attachment ID.
 * @param array $attachment_id { Array of image data

```php
@type int    id       Image's ID as an attachment.
@type string alt      Image's alt text.
@type string path     Image's path.
@type int    width    Width of image.
@type int    height   Height of image.
@type int    pixels   Number of pixels in the image.
@type string type     Image's MIME type.
@type string size     Image's size.
@type string url      Image's URL.
@type int    filesize The file size in bytes, if already set.

}
*

  • @return int
    */
    function wp_kama_wpseo_image_data_filter( $image, $attachment_id ){

    // filter...
    return $image;
    }

    
    
$image(int)
Attachment ID.
$attachment_id(массив)
{ Array of image data
@type int    id       Image's ID as an attachment.
@type string alt      Image's alt text.
@type string path     Image's path.
@type int    width    Width of image.
@type int    height   Height of image.
@type int    pixels   Number of pixels in the image.
@type string type     Image's MIME type.
@type string size     Image's size.
@type string url      Image's URL.
@type int    filesize The file size in bytes, if already set.

}

Где вызывается хук

WPSEO_Image_Utils::get_data()
wpseo_image_data
yoast/inc/class-wpseo-image-utils.php 140
$image = apply_filters( 'wpseo_image_data', $image, $attachment_id );

Где используется хук в Yoast SEO

Использование не найдено.