Created
June 4, 2020 13:47
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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