Commit ef169d0503 for woocommerce
commit ef169d050318fdf08f4f8c29e679f9c956e0cdcd
Author: Vladimir Reznichenko <kalessil@gmail.com>
Date: Mon Feb 9 09:02:11 2026 +0100
[Fix] Admin: switch back to older version of recent reviews widget (#63168)
diff --git a/plugins/woocommerce/changelog/fix-switch-back-to-older-version-of-recent-reviews-widget b/plugins/woocommerce/changelog/fix-switch-back-to-older-version-of-recent-reviews-widget
new file mode 100644
index 0000000000..f2343e9a42
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-switch-back-to-older-version-of-recent-reviews-widget
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Admin: revert to the previous version of the recent reviews widget, as errors have been reported in some setups.
diff --git a/plugins/woocommerce/includes/admin/class-wc-admin-dashboard.php b/plugins/woocommerce/includes/admin/class-wc-admin-dashboard.php
index dea1f19b1b..0556c29f67 100644
--- a/plugins/woocommerce/includes/admin/class-wc-admin-dashboard.php
+++ b/plugins/woocommerce/includes/admin/class-wc-admin-dashboard.php
@@ -477,51 +477,7 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
* Recent reviews widget.
*/
public function recent_reviews() {
- // Backward compatibility mode: if any of the checked below hooks are in use, use the legacy implementation.
- $has_legacy_query_filter = has_filter( 'woocommerce_report_recent_reviews_query_from' );
- $has_legacy_product_title_filter = has_filter( 'woocommerce_admin_dashboard_recent_reviews' );
- $use_legacy_implementation = $has_legacy_query_filter || $has_legacy_product_title_filter;
- if ( $use_legacy_implementation ) {
- if ( $has_legacy_query_filter ) {
- wc_deprecated_hook( 'woocommerce_report_recent_reviews_query_from', '10.5.0' );
- }
- if ( $has_legacy_product_title_filter ) {
- wc_deprecated_hook( 'woocommerce_admin_dashboard_recent_reviews', '10.5.0', 'dashboard-widget-reviews.php template' );
- }
- $this->legacy_recent_reviews();
-
- return;
- }
-
- // Optimized version of the widget: faster SQL queries and templates-based rendering for customization.
- /** @var \WP_Comment[] $comments */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
- $comments = get_comments(
- array(
- 'type' => 'review',
- 'status' => 'approve',
- 'number' => 5,
- 'update_comment_post_cache' => true,
- )
- );
- $comments = array_filter(
- $comments,
- static fn( \WP_Comment $comment ) => current_user_can( 'read_product', $comment->comment_post_ID )
- );
- if ( $comments ) {
- echo '<ul>';
- foreach ( $comments as $comment ) {
- wc_get_template(
- 'dashboard-widget-reviews.php',
- array(
- 'product' => wc_get_product( $comment->comment_post_ID ),
- 'comment' => $comment,
- )
- );
- }
- echo '</ul>';
- } else {
- echo '<p>' . esc_html__( 'There are no product reviews yet.', 'woocommerce' ) . '</p>';
- }
+ $this->legacy_recent_reviews();
}
/**