How to get top averaged rated posts by comments?

you can use below code to display 5 top rated posts based on average rating. i have created below function to get top average rated post using sql queries and wp_query functions. here is updated function for all custom post type. To create rating for comment form : functions.php add_action( 'comment_form_top', 'wpcr_change_comment_form_defaults'); function wpcr_change_comment_form_defaults( )...