Home > Posts > Fix: WordPress not detecting updates, wp_options table corruption

Fix: WordPress not detecting updates, wp_options table corruption

I have been trying recently to troubleshoot a WordPress website that was not detecting available core and plugin updates. So I installed WordPress Debug Bar plugin and after enabling WP_DEBUG in wp-config.php I could open the Debug menu from the WordPress admin bar and see some errors being logged.

image

At the wp-content/wp-debug.log file that I had enabled to log wordpress errors, I could see entries like the following (in mixed Greek/English):

   
[26-Jan-2021 13:15:10 UTC] Σφάλμα Duplicate entry ‘113343’ for key ‘wp_options.PRIMARY’ βάσης δεδομένων WordPress για αίτηση INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES (‘wt_cli_start_date’, ‘1611666910’, ‘yes’) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) από require(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), include_once(‘/plugins/cookie-law-info/cookie-law-info.php’), run_cookie_law_info, Cookie_Law_Info->__construct, Cookie_Law_Info->load_dependencies, require_once(‘/plugins/cookie-law-info/includes/class-cookie-law-info-review_request.php’), Cookie_Law_Info_Review_Request->__construct, Cookie_Law_Info_Review_Request->check_condition, Cookie_Law_Info_Review_Request->reset_start_date, update_option, add_option

Checking the wp_options table with phpMyAdmin I didn’t see it having an option_id with such a value so I opened up the definition for that table from the sidebar and it seems PRIMARY is an index on that table, while the key is option_id as I originally though.

image

Did a new search on it and found this article

MySQL – Fix Error – WordPress Database Error Duplicate Entry for key PRIMARY for Query INSERT INTO wp_options – SQL Authority with Pinal Dave

from a guy I already trusted due to other nice articles on databases. It was as it seems a database corruption (guess the index is corrupted) and running

REPAIR TABLE wp_options

was enough to fix it.

So via phpMyAdmin’s SQL Code tab I executed that simple SQL command and suddenly Wordpess could find core and plugin updates again:

image

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: