Database error unknown column
PHP errors beginning with WordPress database error Unknown column
could be related to either Preload or Remove Unused CSS.
Easy solution
- Export your WP Rocket settings
- Delete and re-install WP Rocket
- Import your WP Rocket settings
This will re-create the necessary database tables and the error should not occur anymore.
Manual solution
If you don't want to reinstall, you can use the following method instead, but this requires greater technical know-how and the willingness to run SQL commands in phpMyAdmin. If you don't know how, or are not comfortable doing this, please use the easy solution above.
First, you have to identify which database table is referred to. Check the error message closely. If it references wpr_rocket_cache
it's related to Preload. Example:
WordPress database error Unknown column 'wpr_cache.is_locked' in 'where clause' for query SELECT wpr_cache.id FROM wp_wpr_rocket_cache
If it references wpr_rucss_used_css
it's related to Remove Unused CSS. Example:
WordPress database error Unknown column 'hash' in 'field list' for query INSERT INTO `wp_wpr_rucss_used_css
You then need to drop (delete) the table mentioned in the error message, from the database:
- ❗️Make a full backup of your database ❗️
- In your WordPress site, disable either Preload or Remove Unused CSS, depending on which table is throwing the error.
- In your hosting control panel, go to phpMyAdmin
- If the error message is related to the cache table, run the command:
DROP TABLE wp_wpr_rocket_cache;
NOTE: If you have a custom prefix for your tables, you will need to replacewp
with your custom prefix. - If the error message is related to the rucss table, run the command:
DROP TABLE wp_wpr_rucss_used_css;
NOTE: If you have a custom prefix for your tables, you will need to replacewp
with your custom prefix. - In your WordPress site, reactivate the related feature. This will recreate the necessary database table.The error should not occur anymore.