WC_Shortcode_Products::set_top_rated_products_query_args()
Set top rated products query args.
Method of the class: WC_Shortcode_Products{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->set_top_rated_products_query_args( $query_args );
- $query_args(array) (required) (passed by reference — &)
- Query args.
Changelog
Since 3.6.5 | Introduced. |
WC_Shortcode_Products::set_top_rated_products_query_args() WC Shortcode Products::set top rated products query args code WC 9.4.2
protected function set_top_rated_products_query_args( &$query_args ) { $query_args['meta_key'] = '_wc_average_rating'; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key $query_args['order'] = 'DESC'; $query_args['orderby'] = 'meta_value_num'; }