{"id":2226,"date":"2021-06-25T15:29:15","date_gmt":"2021-06-25T07:29:15","guid":{"rendered":"https:\/\/www.intelliwolf.com\/?p=2226"},"modified":"2021-06-25T15:32:58","modified_gmt":"2021-06-25T07:32:58","slug":"remove-woocommerce-product-image-link","status":"publish","type":"post","link":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/remove-woocommerce-product-image-link\/","title":{"rendered":"How To Remove WooCommerce Product Image Link"},"content":{"rendered":"\n
WooCommerce automatically wraps your main product image in an <a><\/em> tag. It either links to the lightbox, or if you've disabled product image zoom<\/a> it leaves a link to the image.<\/p>\n\n\n\n<\/p>\n\n\n\n<\/figure>\n\n\n\nIf you want to get rid of that link, there's no easy setting (as of WooCommerce 5.4.1) to disable it.<\/p>\n\n\n\nTo remove the link around the WooCommerce product image, add the following code to your functions.php<\/em>:<\/p>\n\n\n\nadd_filter( 'woocommerce_single_product_image_thumbnail_html', 'custom_remove_product_link' );\nfunction custom_remove_product_link( $html ) {\n return strip_tags( $html, '<div><img>' );\n}<\/code><\/pre>\n\n\n\nThis takes the raw HTML and strips everything other than the div and image.<\/p>\n\n\n\nThe code you're hooking into is at \/templates\/single-product\/product-image.php<\/em>.<\/p>\n\n\n\nThe HTML is actually built by wc_get_gallery_image_html()<\/em> in \/includes\/wc-template-functions.php<\/em>, but if you pull that up, you'll see there are no filters to change how the HTML is built.<\/p>\n","protected":false},"excerpt":{"rendered":"WooCommerce automatically wraps your main product image in an <a> tag. It either links to the lightbox, or if you’ve disabled product image zoom it leaves a link to the image. If you want to get rid of that link, there’s no easy setting (as of WooCommerce 5.4.1) to disable it. To remove the link<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"yoast_head":"\nHow To Remove WooCommerce Product Image Link<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n
<\/p>\n\n\n\n<\/figure>\n\n\n\nIf you want to get rid of that link, there's no easy setting (as of WooCommerce 5.4.1) to disable it.<\/p>\n\n\n\nTo remove the link around the WooCommerce product image, add the following code to your functions.php<\/em>:<\/p>\n\n\n\nadd_filter( 'woocommerce_single_product_image_thumbnail_html', 'custom_remove_product_link' );\nfunction custom_remove_product_link( $html ) {\n return strip_tags( $html, '<div><img>' );\n}<\/code><\/pre>\n\n\n\nThis takes the raw HTML and strips everything other than the div and image.<\/p>\n\n\n\nThe code you're hooking into is at \/templates\/single-product\/product-image.php<\/em>.<\/p>\n\n\n\nThe HTML is actually built by wc_get_gallery_image_html()<\/em> in \/includes\/wc-template-functions.php<\/em>, but if you pull that up, you'll see there are no filters to change how the HTML is built.<\/p>\n","protected":false},"excerpt":{"rendered":"WooCommerce automatically wraps your main product image in an <a> tag. It either links to the lightbox, or if you’ve disabled product image zoom it leaves a link to the image. If you want to get rid of that link, there’s no easy setting (as of WooCommerce 5.4.1) to disable it. To remove the link<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"yoast_head":"\nHow To Remove WooCommerce Product Image Link<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n
If you want to get rid of that link, there's no easy setting (as of WooCommerce 5.4.1) to disable it.<\/p>\n\n\n\n
To remove the link around the WooCommerce product image, add the following code to your functions.php<\/em>:<\/p>\n\n\n\nadd_filter( 'woocommerce_single_product_image_thumbnail_html', 'custom_remove_product_link' );\nfunction custom_remove_product_link( $html ) {\n return strip_tags( $html, '<div><img>' );\n}<\/code><\/pre>\n\n\n\nThis takes the raw HTML and strips everything other than the div and image.<\/p>\n\n\n\nThe code you're hooking into is at \/templates\/single-product\/product-image.php<\/em>.<\/p>\n\n\n\nThe HTML is actually built by wc_get_gallery_image_html()<\/em> in \/includes\/wc-template-functions.php<\/em>, but if you pull that up, you'll see there are no filters to change how the HTML is built.<\/p>\n","protected":false},"excerpt":{"rendered":"WooCommerce automatically wraps your main product image in an <a> tag. It either links to the lightbox, or if you’ve disabled product image zoom it leaves a link to the image. If you want to get rid of that link, there’s no easy setting (as of WooCommerce 5.4.1) to disable it. To remove the link<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"yoast_head":"\nHow To Remove WooCommerce Product Image Link<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n
add_filter( 'woocommerce_single_product_image_thumbnail_html', 'custom_remove_product_link' );\nfunction custom_remove_product_link( $html ) {\n return strip_tags( $html, '<div><img>' );\n}<\/code><\/pre>\n\n\n\nThis takes the raw HTML and strips everything other than the div and image.<\/p>\n\n\n\nThe code you're hooking into is at \/templates\/single-product\/product-image.php<\/em>.<\/p>\n\n\n\nThe HTML is actually built by wc_get_gallery_image_html()<\/em> in \/includes\/wc-template-functions.php<\/em>, but if you pull that up, you'll see there are no filters to change how the HTML is built.<\/p>\n","protected":false},"excerpt":{"rendered":"WooCommerce automatically wraps your main product image in an <a> tag. It either links to the lightbox, or if you’ve disabled product image zoom it leaves a link to the image. If you want to get rid of that link, there’s no easy setting (as of WooCommerce 5.4.1) to disable it. To remove the link<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"yoast_head":"\nHow To Remove WooCommerce Product Image Link<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n
This takes the raw HTML and strips everything other than the div and image.<\/p>\n\n\n\n
The code you're hooking into is at \/templates\/single-product\/product-image.php<\/em>.<\/p>\n\n\n\nThe HTML is actually built by wc_get_gallery_image_html()<\/em> in \/includes\/wc-template-functions.php<\/em>, but if you pull that up, you'll see there are no filters to change how the HTML is built.<\/p>\n","protected":false},"excerpt":{"rendered":"WooCommerce automatically wraps your main product image in an <a> tag. It either links to the lightbox, or if you’ve disabled product image zoom it leaves a link to the image. If you want to get rid of that link, there’s no easy setting (as of WooCommerce 5.4.1) to disable it. To remove the link<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"yoast_head":"\nHow To Remove WooCommerce Product Image Link<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n
The HTML is actually built by wc_get_gallery_image_html()<\/em> in \/includes\/wc-template-functions.php<\/em>, but if you pull that up, you'll see there are no filters to change how the HTML is built.<\/p>\n","protected":false},"excerpt":{"rendered":"WooCommerce automatically wraps your main product image in an <a> tag. It either links to the lightbox, or if you’ve disabled product image zoom it leaves a link to the image. If you want to get rid of that link, there’s no easy setting (as of WooCommerce 5.4.1) to disable it. To remove the link<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"yoast_head":"\nHow To Remove WooCommerce Product Image Link<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n
WooCommerce automatically wraps your main product image in an <a> tag. It either links to the lightbox, or if you’ve disabled product image zoom it leaves a link to the image. If you want to get rid of that link, there’s no easy setting (as of WooCommerce 5.4.1) to disable it. To remove the link<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"yoast_head":"\n