woocommerce_reviews_title
Filters the heading shown above the product review list.
Usage
add_filter( 'woocommerce_reviews_title', 'wp_kama_woocommerce_reviews_title_filter', 10, 3 );
/**
* Function for `woocommerce_reviews_title` filter-hook.
*
* @param string $reviews_title Review count heading. The count is escaped, the product title is
* run through wp_kses_post() and wrapped in a span.
* @param int $count Number of reviews for the product.
* @param WC_Product $product Product the reviews belong to.
*
* @return string
*/
function wp_kama_woocommerce_reviews_title_filter( $reviews_title, $count, $product ){
// filter...
return $reviews_title;
}
- $reviews_title(string)
- Review count heading. The count is escaped, the product title is run through wp_kses_post() and wrapped in a span.
- $count(int)
- Number of reviews for the product.
- $product(WC_Product)
- Product the reviews belong to.
Changelog
| Since 3.6.0 | Introduced. |
Where the hook is called
woocommerce_reviews_title
woocommerce/templates/single-product-reviews.php 44
echo apply_filters( 'woocommerce_reviews_title', $reviews_title, $count, $product ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- The base heading is sanitised above and the filter returns extension-controlled markup by design.
Where the hook is used in WooCommerce
woocommerce/src/Blocks/BlockTypes/ProductDetails.php 484
add_filter( 'woocommerce_reviews_title', '__return_empty_string' );
woocommerce/src/Blocks/BlockTypes/ProductDetails.php 492
remove_filter( 'woocommerce_reviews_title', '__return_empty_string' );