Skip to content

Instantly share code, notes, and snippets.

@roykho
Last active April 17, 2023 12:58
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roykho/14c57ab320b2f999e86bb0b531b2e55a to your computer and use it in GitHub Desktop.
Save roykho/14c57ab320b2f999e86bb0b531b2e55a to your computer and use it in GitHub Desktop.
WooCommerce: Delete old lingering admin notices
// Use these instructions at your own risk. Make sure you have full site/database backup prior to proceeding.
//
// Install this plugin to add custom PHP code https://wordpress.org/plugins/code-snippets/
// Activate the plugin.
// Go to Snippets->Add New
// Paste the following code into the provided "Code" field.
// Choose to Run Only Once.
// Click Save changes and activate button at the bottom.
// After running it once, I would suggest to remove this snippet otherwise you may miss out on important updates in the future.
// After running this, you may get a fresh copy of the notices once more. This is normal and this time when you dismiss them, they should stay gone..
global $wpdb;
$wpdb->query( "DELETE FROM `{$wpdb->prefix}wc_admin_notes` WHERE name = 'wc-update-db-reminder'" );
$wpdb->query( "DELETE FROM `{$wpdb->prefix}wc_admin_note_actions` WHERE name = 'update-db_run'" );
$wpdb->query( "DELETE FROM `{$wpdb->prefix}wc_admin_note_actions` WHERE name = 'update-db_learn-more'" );
$wpdb->query( "DELETE FROM `{$wpdb->prefix}wc_admin_note_actions` WHERE name = 'update-db_done'" );
$wpdb->query( "DELETE FROM `{$wpdb->prefix}wc_admin_notes` WHERE name = 'wc-admin-coupon-page-moved'" );
$wpdb->query( "DELETE FROM `{$wpdb->prefix}wc_admin_note_actions` WHERE name = 'remove-legacy-coupon-menu'" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment