WordPress filter hook
dokan_product_image_attributes
Fired by 2 WordPress plugins, running on 30K+ sites between them.
“Filter the product image attributes”
How to use dokan_product_image_attributes
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'dokan_product_image_attributes', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );Argument names come from Dokan: AI Powered WooCommerce Multivendor Marketplace Solution's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
2 plugins that fire dokan_product_image_attributes
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Dokan: AI Powered WooCommerce Multivendor Marketplace Solution30,000+ installs
apply_filters( 'dokan_product_image_attributes', [ 'img' => [ 'alt' => [], 'class' => [], 'height' => [], 'src' => [], 'width' => [], 'srcset' => [], 'data-srcset' => [], 'data-src' => [], ], ] )templates/products/products-listing-row.php:26 -
WPCafe Multivendor Restaurant Addon for Dokan100+ installs
apply_filters( 'dokan_product_image_attributes', array( 'img' => array( 'alt' => array(), 'class' => array(), 'height' => array(), 'src' => array(), 'width' => array(), 'srcset' => array(), 'data-srcset' => array(), 'data-src' => array(), ), ) )templates/orders/order-item-html.php:3
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.