Where are comment ratings stored?

I have a bilingual site. Previously I was using a language plugin that would store the different languages in the same post which means all my comments belonged to that post. I switched to WPML which manages 1 post per language. In my migration process, I therefore ended up with twice as many posts since the migration tool essentially read each post, took the second language from the post and created a new post with it. Previously

  • one post, 2 languages, and a plugin that displays the relevant language
  • one comment section no matter the language displaying a mix of comments in both languages

Now with WPML:

  • 2 posts, one per language
  • the original post contains the primary language and ALL the comments
  • the new post contains the secondary language and no comments whatsoever.

That didn't worry me because there are plenty of plugins to copy / move comments from a post to another. So I started migrating some comments from posts in one language to the corresponding ones in a different language. However... I just noticed the ratings did not get copied over. Additionally, when I look at the backend (/wp-admin), I cannot see the ratings inside a given comment.

So... are ratings stored separately? I'm not using any rating plugin AFAIK. This is the core Wordpress feature. Or is there another plugin I'm not aware of that's adding this feature?

Thanks

Topic rating plugin-wpml comments Wordpress

Category Web


As stated in the comments below the question,

Comments don't have ratings in WordPress

I went on and inspected the HTML source for one of my posts and figured out which plugin generated the rating based on the CSS class name. I should have known better. The plugin is Tasty Recipes by WP Tasty.

I then looked at my SQL DB and figured out that comment ratings are stored in wp_commentmeta with a key of ERRating:

    SELECT * FROM `wp_commentmeta` WHERE meta_key='ERRating'

Here's a more complete SQL statement that shows how to retrieve the rating:

SELECT c.comment_id, 
       c.comment_post_id, 
       c.comment_author, 
       c.comment_content, 
       m.meta_key, 
       m.meta_value 
FROM   `wp_del201712_comments` AS c 
       LEFT JOIN wp_del201712_commentmeta m 
              ON m.comment_id = c.comment_id 
WHERE  c.comment_post_id = 12066 
       AND c.comment_approved = '1' 
       AND m.meta_key = 'ERRating' 

Just replace the post ID with yours to see the results.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.