Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apmwebdev/6a4e4c4032c4d5970050112c03757049 to your computer and use it in GitHub Desktop.
Save apmwebdev/6a4e4c4032c4d5970050112c03757049 to your computer and use it in GitHub Desktop.
Remove the alert prompting you to uninstall an outdated version of WC Admin
<?php
/**
* Plugin Name: WooCommerce Remove Uninstall wc-admin Notice
* Plugin URI: https://woocommerce.com
* Description: Deletes uninstall wc-admin notice
* Author: WooCommerce
* Domain Path: /languages
* Version: 0.1
*/
function woocommerce_delete_deactivate_plugin_note() {
global $wpdb;
if ( ! class_exists( 'WC_Data_Store' ) ) {
return;
}
$data_store = \WC_Data_Store::load( 'admin-note' );
$note_ids = $data_store->get_notes_with_name( 'wc-admin-deactivate-plugin' );
foreach ( (array) $note_ids as $note_id ) {
return $wpdb->get_col(
$wpdb->prepare(
"UPDATE {$wpdb->prefix}wc_admin_notes set status = 'actioned' WHERE note_id = %d",
$note_id
)
);
}
}
add_action( 'admin_notices', 'woocommerce_delete_deactivate_plugin_note' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment