This plugin will disable WordPress core update notification, plugin update notification and theme update notifications and inline warnings in your admin panel.
Add below snipats in your theme’s functions.php.
1 2 | remove_action('load-update-core.php', 'wp_update_plugins'); add_filter('pre_site_transient_update_plugins', '__return_null'); |
Add below snipats in your theme’s functions.php.
1 2 | remove_action('load-update-core.php', 'wp_update_themes'); add_filter('pre_site_transient_update_themes', create_function('$a', "return null;")); |
Add below snipats in your theme’s functions.php.
1 2 3 4 5 6 7 | if (!current_user_can('update_core')) { return; } add_action('init', create_function('$a', "remove_action( 'init', 'wp_version_check' );"), 2); add_filter('pre_option_update_core', '__return_null'); add_filter('pre_site_transient_update_core', '__return_null'); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | <?php /* * Plugin Name: Disable Update Notifications * Plugin URI: http://wordpress.org * Description: This plugin will disable WordPress core update notification, plugin update notification and theme update notifications and inline warnings in your admin panel. * Author: Prem Tiwari * Version: 1.0.0 * Author URI: http://wordpress.org */ if (!defined('ABSPATH')) { exit; // Exit if accessed directly } function admin_style() { wp_enqueue_style('bootstrap_switch',plugins_url("css/bootstrap-switch.css",__FILE__)); wp_enqueue_style('Fm_admin_style',plugins_url("css/admin_style.css",__FILE__)); } // Add js script function fm_enqueue_script() { wp_enqueue_script( 'jquery-js', '/wp-includes/js/jquery/jquery.js', false ); wp_enqueue_script('bootstrap-js',plugins_url("js/bootstrap.min.js",__FILE__)); wp_enqueue_script('bootstrap-switch',plugins_url("js/bootstrap-switch.js",__FILE__)); } // add bootstrap switch inline script function fm_inline_script() { if ( wp_script_is( 'jquery', 'done' ) ) { ?> <script type='text/javascript'> jQuery(function(argument) { jQuery('.switchBtn').bootstrapSwitch(); })</script> <?php } } add_action('admin_enqueue_scripts', 'admin_style'); add_action( 'admin_enqueue_scripts', 'fm_enqueue_script' ); add_action( 'admin_footer', 'fm_inline_script' ); function dwnSettings() { echo '<h3 class="mlw-header">Hide notifications and inline warnings Settings</h3><hr>'; if(isset($_GET['msg'])) { echo '<div class="updated notice notice-success is-dismissible below-h2" id="message"><p>Settings updated. </p></div>'; } ?> <div class="fm-wrapper"> <form name="fm_dwun" method="POST"> <table class="fm-content"> <tbody> <tr class="mlw-box-left"> <th scope="row"> <label for="dpun">Disable Plugin Update Notifications </label> </th> <td> <input type="checkbox" class="switchBtn" id="dpun" name="dpun" <?php if (get_option("dpun_setting") == "on") { echo "checked"; } ?>> </td> </tr> <tr> <th scope="row"> <label for="dwtu">Disable Theme Update Notifications</label> </th> <td> <input type="checkbox" class="switchBtn" id="dwtu" name="dwtu" <?php if (get_option("dwtu_setting") == "on") { echo "checked"; } ?>> </td> </tr> <tr> <th scope="row"> <label for="dwcun">Disable Core Update Notifications</label> </th> <td> <input type="checkbox" class="switchBtn" id="dwcun" name="dwcun" <?php if (get_option("dwcun_setting") == "on") { echo "checked"; } ?>> </td> </tr> </tbody> </table> <p class="fm-footer"> <input type="submit" name="publish" id="publish" class="button button-primary" value="Save Changes"></p> </form> </div> <?php // Update plugin settings if (isset($_REQUEST['publish'])) { // set the variables if($_POST['dpun']){$dpun='on';} else {$dpun='off';} if($_POST['dwtu']){$dwtu='on';} else {$dwtu='off';} if($_POST['dwcun']){$dwcun='on';} else {$dwcun='off';} //update in option table update_option('dpun_setting' , $dpun); update_option('dwtu_setting' , $dwtu); update_option('dwcun_setting' , $dwcun); echo ("<SCRIPT LANGUAGE='JavaScript'> window.location.href='".$_SERVER['HTTP_REFERER']."&msg=success'; </SCRIPT>"); } } #add in admin side panel function Amin_menu_dwnSettings() { add_options_page('Disable Wordpress Notification Settings', 'Disable Notification Settings', 'manage_options', 'fm-dwns', dwnSettings); } add_action('admin_menu', 'Amin_menu_dwnSettings'); // Disable the wordpress plugin update notifications if (get_option('dpun_setting') == "on") { remove_action('load-update-core.php', 'wp_update_plugins'); add_filter('pre_site_transient_update_plugins', '__return_null'); } // Disable the wordpress theme update notifications if (get_option('dwtu_setting') == "on") { remove_action('load-update-core.php', 'wp_update_themes'); add_filter('pre_site_transient_update_themes', create_function('$a', "return null;")); } // Disable the wordpress core update notifications if (get_option('dwcun_setting') == "on") { add_action('after_setup_theme', 'remove_core_updates'); function remove_core_updates() { if (!current_user_can('update_core')) { return; } add_action('init', create_function('$a', "remove_action( 'init', 'wp_version_check' );"), 2); add_filter('pre_option_update_core', '__return_null'); add_filter('pre_site_transient_update_core', '__return_null'); } } ?> |
Download from wordpress plugin directory : Download Demo
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: core update, disable, hide Warnings, plugin update, update notifications, wordpress