Sort posts by rating
-
Hi!
I am wondering how can I make a query that sorts the posts by rating values (DESC).
I am using this code: https://gist.github.com/danielpowney/716b65779dd402743c59#file-sort_wp_query-php and I am making the query using AJAX on button click but the ajax call responding with 500 Internal Server Error (Referrer Policy:no-referrer-when-downgrade).This is the query:
$query = new WP_Query( array(
‘post_type’ => ‘post’,
‘post_status’ => ‘publish’,
‘tax_query’ => array(
‘relation’ => ‘AND’,
array(
‘taxonomy’ => ‘category’,
‘field’ => ‘term_id’,
‘terms’ => $category,
),
array(
‘taxonomy’ => ‘area’,
‘field’ => ‘slug’,
‘terms’ => $area,
),
),
‘mrp_sort_highest_rated’ => true) );
I need to query the taxonomies and sort by rating.
Thank you!
- The topic ‘Sort posts by rating’ is closed to new replies.