实际上这是个插件叫 Disable Updates,但是想就这点代码直接写在主题的功能文件里倒来得更加方便:
[code]
// 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;" ) );
[/code]
Comments
916 responses to “关闭 WordPress 自动更新”