Site Reviews allows you to assign reviews to multiple categories, so it sounds like that is what happened.
You can click on the Category counts to display all reviews assigned to that category.
You can also customise the columns and filters on the All Reviews page to see which categories the reviews are assigned to. From there, you can edit the review assignments as needed.
Thanks for your answer.
I’ve enabled the Categories column on the All Reviews page, but oddly, all reviews are only assigned to one (correct) category.
Also when I look directly in the database, there is only one category ID listed in the postmeta table for each review.
So it seems that the review and category relations are stored correctly in the database, but the shortcode to display the reviews and the export somehow grab two categories together.
Is there any other place where the export and the plugin shortcode could get its data from?
On further digging I’ve noticed that in the _term_taxonomy table the term_taxonomy_id and term_id are shifted one value. I don’t know if this is normal or not:
term_taxonomy_id|taxonomy |term_id|description|parent|count|
—————-+——————–+——-+———–+——+—–+
120|site-review-category| 119| | 0| 3|
121|site-review-category| 120| | 0| 0|
@peanutbuttah
After some research, I think I found the problem. Did your website ever run WordPress 4.2 or earlier?
This article explains the problem and why it’s happening: https://salferrarello.com/term_taxonomy_id-vs-term_id/
term_id
and taxonomy_term_id
usage in WordPress is a little confusing. I’ll look into seeing if there is a way to avoid this from happening.
Thanks for looking in to it!
Yes, the site did run WP 4.2 or earlier.
The number of reviews on my site is small enough to manually manipulate the database. What do you think is the best option to fix this:
-Shall I edit the database so that both ID’s have the same value?
or
-Shall I reinstall the plugin and just re-add the reviews manually?
@peanutbuttah
I think I have a solution for you! Here is a code snippet which will sync the term_taxonomy_id
and term_id
values in your database, correcting the problem that was initially caused by upgrading your website from WordPress v4.2 or earlier.
IMPORTANT: Please make a backup of your database that can be restored in case something goes wrong. Do this before using the code snippet.
You can use the Code Snippets plugin to run this snippet on your website. Once you have activated the snippet, you can immediately deactivate it and remove it from your website (as it will run during the page reload).
This code snippet will do the following:
- Query the database for all entries in the
wp_term_relationships
and wp_term_taxonomy
tables.
- Remove all entries from the
wp_term_relationships
and wp_term_taxonomy
tables.
- Repopulate the the
wp_term_relationships
and wp_term_taxonomy
tables with the fixed term_taxonomy_id
column values.
Here is the Code Snippet: https://pastebin.com/vr2eTfzS
AGAIN: Please first make a backup of your database that can be restored in case something goes wrong. Do this before using the code snippet!
Thank you so much for your time and effort.
The snippet did work, as in both IDs were synchronized. However some of the reviews still kept showing up on multiple categories.
On further inspection I noticed that in the 2jp_glsr_assigned_terms table most rating_id’s have duplicate entries, both assigned to a different term_id:
rating_id | term_id
——————–
68 | 140
68 | 141
If I delete the incorrect ones the problem seems to be solved. New test reviews show up only once.
I’ll go through this last step manually, that’s very doable.
Thanks again for your great support!
Did you try running the Reset Assigned Meta Values tool?
I did, but unfortunately that didn’t fix it.
-
This reply was modified 1 year, 3 months ago by peanutbuttah.