使用wordpress建设网站时,会遇到不想像显示产品评论 信息选项卡太多内容,如何从WooCommerce单一产品页面中删除描述和评论标签。有时我们需要从单一产品页面中删除产品描述和产品评论标签,以使单个产品页面简单而令人印象深刻,或者我们不希望该用户将分享关于网站上列出的产品的评论。如何删除WooCommerce中的描述,评论和其他信息选项卡:

在functions.php文件的末尾使用下面的代码。

add_filter( 'woocommerce_product_tabs', 'wcs_woo_remove_reviews_tab', 98 );
function wcs_woo_remove_reviews_tab($tabs) {
    unset($tabs['reviews']);
    return $tabs;
}

此外,要删除额外的信息选项卡,然后使用下面的你的functions.php文件:

add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
    unset( $tabs['description'] ); // Remove the description tab
    unset( $tabs['reviews'] ); // Remove the reviews tab
    unset( $tabs['additional_information'] ); // Remove the additional information tab
    return $tabs;
}

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注