I want to sort comments by a number of likes which is saved as a meta_key in the wp_commentmeta table: I have tried two ways but it doesn't sort the comments by most liked comment at the top. Please suggest the solution:
$args = array(
'post_type' => 'comment',
'post_status' => 'publish',
'callback' => 'listingo_comments',
'meta_key' => 'cld_like_count',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
wp_list_comments($args);
// and second way
$query = new WP_Query(array(
'post_status' => 'publish',
'post_type' => 'comment',
'callback' => 'listingo_comments',
'orderby' => 'cld_like_count',
'order' => 'DESC'
));
wp_list_comments($query);