Bug [with Fix] Multiple Duplicate Table Entries
-
I believe this is a bug, although doesn’t affect functionality. Every time you edit and save an article a new set of meta data is added, so filling the meta database unnecessarily.
If you therefore click on “Screen Options” and tick “Custom Fields” when editing a post, you get a long list of duplicates, 4 for every time the article is saved.
The reason for this is that WP function update_post_meta return false if the data already exists (see below), but in the plugin in the case that data already exists the false from update_post_meta is assumed to mean that the data doesn’t exist, and add_post_meta is then called and a duplicate created. This is around line 208 in author-product-reviews.php.
The fix is just to remove the 4 conditional calls to add_post_meta.
_____
From WP codex, for update_post_meta:
Returns meta_id if the meta doesn’t exist, otherwise returns true on success and false on failure. It also returns false if the value submitted is the same as the value that is already in the database.
- The topic ‘Bug [with Fix] Multiple Duplicate Table Entries’ is closed to new replies.