woocommerce_placeholder_img
Filters the placeholder image HTML.
Usage
add_filter( 'woocommerce_placeholder_img', 'wp_kama_woocommerce_placeholder_img_filter', 10, 4 );
/**
* Function for `woocommerce_placeholder_img` filter-hook.
*
* @param string $image_html The placeholder image HTML.
* @param string $size Image size.
* @param array $dimensions Image width and height.
* @param array $attr Attributes for the image markup.
*
* @return string
*/
function wp_kama_woocommerce_placeholder_img_filter( $image_html, $size, $dimensions, $attr ){
// filter...
return $image_html;
}
- $image_html(string)
- The placeholder image HTML.
- $size(string)
- Image size.
- $dimensions(array)
- Image width and height.
- $attr(array)
- Attributes for the image markup.
Changelog
| Since 2.0.0 | Introduced. |
| Since 11.1.0 | Added the $attr parameter. |
Where the hook is called
woocommerce_placeholder_img
woocommerce/includes/wc-product-functions.php 495
return apply_filters( 'woocommerce_placeholder_img', $image_html, $size, $dimensions, $attr );