WooCommerce 第一个产品图片重复
WooCommerce the first product image is repeated
本网站(digitalzakka.com)已迁移,但第一个产品图片重复。
产品库中没有重复项。
我还设置了一张产品图片:
产品图片和产品图库可能重复。
I have 10,000
products, is there any way to solve this problem in batches?
这是因为您在两个地方添加了图片。第一张在产品特色图片中,第二张在产品图库图片中。
如果您在产品特色图片中添加了一些产品,则无需将该图片添加到产品图库图片中。因此,只需从图库中删除该图片并查看即可。
如果您想分批进行,那么一个简单的解决方案是从 woocommerce 产品中删除特色图片。试试下面的代码:
add_filter('woocommerce_single_product_image_thumbnail_html', 'remove_featured_image', 10, 2);
function remove_featured_image($html, $attachment_id ) {
global $post, $product;
$featured_image = get_post_thumbnail_id( $post->ID );
if ( $attachment_id == $featured_image )
$html = '';
return $html;
}
我运行遇到了同样的问题。我通过上面的代码解决了。
本网站(digitalzakka.com)已迁移,但第一个产品图片重复。
产品库中没有重复项。
我还设置了一张产品图片:
产品图片和产品图库可能重复。
I have
10,000
products, is there any way to solve this problem in batches?
这是因为您在两个地方添加了图片。第一张在产品特色图片中,第二张在产品图库图片中。
如果您在产品特色图片中添加了一些产品,则无需将该图片添加到产品图库图片中。因此,只需从图库中删除该图片并查看即可。
如果您想分批进行,那么一个简单的解决方案是从 woocommerce 产品中删除特色图片。试试下面的代码:
add_filter('woocommerce_single_product_image_thumbnail_html', 'remove_featured_image', 10, 2);
function remove_featured_image($html, $attachment_id ) {
global $post, $product;
$featured_image = get_post_thumbnail_id( $post->ID );
if ( $attachment_id == $featured_image )
$html = '';
return $html;
}
我运行遇到了同样的问题。我通过上面的代码解决了。