WordPress at Your Fingertips
function is not described

WC_Shortcode_Products::order_by_rating_post_clauses() public WC 3.2.0

Order by rating.

{} It's a method of the class: WC_Shortcode_Products{}

No Hooks.

Return

Array.

Usage

$result = WC_Shortcode_Products::order_by_rating_post_clauses( $args );
$args(array) (required)
Query args.

Changelog

Since 3.2.0 Introduced.

Code of WC_Shortcode_Products::order_by_rating_post_clauses() WC 5.9.0

public static function order_by_rating_post_clauses( $args ) {
	global $wpdb;

	$args['where']  .= " AND $wpdb->commentmeta.meta_key = 'rating' ";
	$args['join']   .= "LEFT JOIN $wpdb->comments ON($wpdb->posts.ID = $wpdb->comments.comment_post_ID) LEFT JOIN $wpdb->commentmeta ON($wpdb->comments.comment_ID = $wpdb->commentmeta.comment_id)";
	$args['orderby'] = "$wpdb->commentmeta.meta_value DESC";
	$args['groupby'] = "$wpdb->posts.ID";

	return $args;
}