Add `woocommerce_top_rated_widget_args` filter for WC_Widget_Top_Rated_Products widget
This commit is contained in:
parent
93e0a91faa
commit
e3ac006420
|
@ -58,16 +58,18 @@ class WC_Widget_Top_Rated_Products extends WC_Widget {
|
|||
|
||||
$number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : $this->settings['number']['std'];
|
||||
|
||||
$query_args = array(
|
||||
'posts_per_page' => $number,
|
||||
'no_found_rows' => 1,
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'product',
|
||||
'meta_key' => '_wc_average_rating',
|
||||
'orderby' => 'meta_value_num',
|
||||
'order' => 'DESC',
|
||||
'meta_query' => WC()->query->get_meta_query(),
|
||||
'tax_query' => WC()->query->get_tax_query(),
|
||||
$query_args = apply_filters( 'woocommerce_top_rated_widget_args',
|
||||
array(
|
||||
'posts_per_page' => $number,
|
||||
'no_found_rows' => 1,
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'product',
|
||||
'meta_key' => '_wc_average_rating',
|
||||
'orderby' => 'meta_value_num',
|
||||
'order' => 'DESC',
|
||||
'meta_query' => WC()->query->get_meta_query(),
|
||||
'tax_query' => WC()->query->get_tax_query(),
|
||||
)
|
||||
); // WPCS: slow query ok.
|
||||
|
||||
$r = new WP_Query( $query_args );
|
||||
|
|
Loading…
Reference in New Issue