Skip to content

Instantly share code, notes, and snippets.

@rynaldos-zz
Last active March 20, 2021 02:24
Show Gist options
  • Save rynaldos-zz/0a54362495c35a1850e80234350d2d5a to your computer and use it in GitHub Desktop.
Save rynaldos-zz/0a54362495c35a1850e80234350d2d5a to your computer and use it in GitHub Desktop.
[WooCommerce 3.0+] Remove links from single product image thumbnails
@baras
Copy link

baras commented Oct 8, 2020

Thanks @rynaldos and @pauloiankoski!

As of PHP 7.4.0 the line can be written as:

add_filter( 'woocommerce_single_product_image_thumbnail_html', 'wc_remove_link_on_thumbnails' );
function wc_remove_link_on_thumbnails( $html ) {
	return strip_tags( $html, [ 'div', 'img' ] );
}

@HadalyVillasclaras
Copy link

Hi, It seem it also works one my site but I don't know why the featured image is duplicate now ! Any clue about that?
Cheers
Captura de pantalla 2020-10-10 a las 13 11 01
Captura de pantalla 2020-10-10 a las 13 11 10
Captura de pantalla 2020-10-10 a las 13 11 18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment