Skip to content

Instantly share code, notes, and snippets.

@bologer
Created March 30, 2020 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bologer/5f16b016e81c7c01c5bf5950be5e80ea to your computer and use it in GitHub Desktop.
Save bologer/5f16b016e81c7c01c5bf5950be5e80ea to your computer and use it in GitHub Desktop.
Remove AnyComment's comments template from WooCommerce single page
<?php
/**
* Overrides anycomment template on WooCommerce single product page.
*
* @param $theme_template
*
* @return string
*/
function anycomment_woocommerce_override( $theme_template ) {
if ( class_exists( 'WooCommerce' ) && is_product() ) {
return STYLESHEETPATH . '/comments.php';
}
return $theme_template;
}
add_filter( 'comments_template', 'anycomment_woocommerce_override', 1100, 1 );
add_filter( 'woocommerce_product_tabs', 'woocommerce_default_product_tabs', 1000 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment