Retrieve meta_value from add_comment_meta

You are saving your data with non-unique key (false as last argument), but retrieve it it as singular data (true as last argument). This is likely returning you the first voter on comment. You need to retrieve complete array of values and work with it to be operating on complete data.

Adding Comment Meta to a new comment notification email

The solution was to add a priority number to the comment_post action that was saving my rating value, as shown below: function save_comment_meta_data( $comment_id ) { if ( ( isset( $_POST[‘rating’] ) ) && ( $_POST[‘rating’] != ”) ) { $rating = wp_filter_nohtml_kses($_POST[‘rating’]); add_comment_meta( $comment_id, ‘rating’, $rating ); } } add_action( ‘comment_post’, ‘save_comment_meta_data’, 5 ); … Read more

How to get top rated posts using wp query?

Don’t worry. I have found solution for your issue. 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. function top_rated_post_via_comment_of_CPT($post_per_page = 5){ global … Read more

tech