-
-
Save timmyc/ee0c6f4cb3ed82620efaa16386e62c6b to your computer and use it in GitHub Desktop.
<?php | |
/** | |
* Plugin Name: Remove WooCommerce DB Notice | |
* Plugin URI: https://woocommerce.com | |
* Description: Clears out any pending WooCommerce DB Update notices | |
* Author: WooCommerce | |
* Domain Path: /languages | |
* Version: 0.1 | |
*/ | |
function woocommerce_set_database_update_notice_as_actioned() { | |
// Bail if WoocCommerce notes class is not present. | |
if ( ! class_exists( 'WC_Notes_Run_Db_Update' ) ) { | |
return; | |
} | |
$woocommerce_notes_db = new WC_Notes_Run_Db_Update(); | |
$woocommerce_notes_db->set_notice_actioned(); | |
} | |
add_action( 'admin_notices', 'woocommerce_set_database_update_notice_as_actioned' ); |
I'm still seeing the message even though the database field is shown as "actioned."
I've worked around it by adding code to my functions.php file:
`// Remove WooCommerce database update done message
add_action( 'admin_head', 'admin_css' );
function admin_css() {
echo "
";
}`
Easy fix in sql:
update wp_wc_admin_notes SET status='actioned' where name='wc-update-db-reminder';
Easy fix in sql:
update wp_wc_admin_notes SET status='actioned' where name='wc-update-db-reminder';
This helped for "WooCommerce database update in progress" message, thanks!
However, I have another one too:
Is there anything similar can be done with "WooCommerce is updating product data in the background" message?
To hide the coupons notices the name on table xx_wc_admin_notes is 'wc-admin-coupon-page-moved' ;)
It was still visible in the admin UI. Although 12hrs on the notice seems to have changed to 'WooCommerce database update done'. If I click the 'Thanks' button, I get an error 'Action failed. Please refresh the page and retry.'
I perhaps wouldn't recommend this gist as a fix, it's possible that leaving WooCommerce to run its scripts/do its thing for a set amount of time (depending on database size I guess) first would be wise.
Edit: I can confirm that the note is marked as 'actioned' in the database (
select * from $PREFIX_wc_admin_notes
), but the message does not go away. Changing the status to 'unactioned' also didn't help.My issue seems to be the same as that listed here: https://wordpress.org/support/topic/woocommerce-database-update-done/
Note: I am running WP Multisite.