实际上这是个插件叫 Disable Updates,但是想就这点代码直接写在主题的功能文件里倒来得更加方便:

// Hides all upgrade notices
add_action('admin_menu','hide_admin_notices');
function hide_admin_notices() {
    remove_action( 'admin_notices', 'update_nag', 3 );
}

// Remove the 'Updates' menu item from the admin interface
add_action('admin_menu', 'remove_menus', 102);
function remove_menus() {
	global $submenu;
	remove_submenu_page ( 'index.php', 'update-core.php' );
}

// Disable core updates
remove_action( 'load-update-core.php', 'wp_update_core' );
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );

// Disable theme updates
remove_action( 'load-update-core.php', 'wp_update_themes' );
add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );

// Disable plugin updates
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );

相关文章

  1. wp_head() 函数优化
  2. WordPress 如何修改密码保护表单的文字说明
  3. WordPress UTF8 中文截取
  4. WordPress Feeds 定制
  5. Post Formats of WordPress