我尝试使用其他帖子中的建议,但它们不起作用。我希望不在我的产品图像area/image库中显示特色产品图像,因为我将标题中的特色图像用作背景图像,并且它的宽度太大而无法在图库中使用。
到目前为止,这是最接近工作的方法,但是我遇到了错误。但是它确实可以满足我的需求。
任何解决此问题的方法,这样我就不会收到错误?
这是我的代码:
add_filter('woocommerce_single_product_image_thumbnail_html', 'remove_featured_image', 10, 3);
function remove_featured_image($html, $attachment_id, $post_id) {
$featured_image = get_post_thumbnail_id($post_id);
if ($attachment_id != $featured_image) {
return $html;
}
return '';
}
Run Code Online (Sandbox Code Playgroud)
这是错误:
/home/…/plugins/my-custom-functions/inc/php/functional.php(93)中的remove_featured_image()缺少参数3,第4行的eval()代码
警告:/home…/plugins/my-custom-functions/inc/php/functional.php(93)中的remove_featured_image()缺少参数3,第4行的eval()代码