wordpress如何禁用更新并且禁用更新提示?

wordpress如何禁用更新并且禁用更新提示?

可以在主题 functions.php 文件添加以下代码来实现禁用 WordPress 核心、插件的更新以及更新提醒:

 

/**
* Disable WordPress core updates
*/
define(‘WP_AUTO_UPDATE_CORE’, false);

/**
* Disable plugin updates
*/
remove_action(‘load-update-core.php’, ‘wp_update_plugins’);
add_filter(‘pre_site_transient_update_plugins’, ‘__return_null’);

/**
* Disable theme updates
*/
remove_action(‘load-update-core.php’, ‘wp_update_themes’);
add_filter(‘pre_site_transient_update_themes’, ‘__return_null’);

/**
* Disable update notifications in admin
*/
remove_action(‘admin_notices’, ‘update_nag’, 3);

/**
* Remove the update link from the admin bar
*/
function remove_update_toolbar() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu(‘updates’);
}add_action(‘admin_bar_menu’, ‘remove_update_toolbar’, 999);

/**
* Remove update count from dashboard
*/
function remove_dashboard_update() {
global $menu, $submenu;
$menu[65][0] = ‘Dashboard’;
$submenu[‘index.php’][10][0] = ‘Updates ‘;
}add_action(‘admin_menu’, ‘remove_dashboard_update’);

/**
* Remove update count from admin menu
*/
function remove_admin_menu_update_count() {
global $menu;
$menu[2][0] = ‘Posts’;
}add_action(‘admin_menu’, ‘remove_admin_menu_update_count’);

/**
* Hide update notice in the footer of admin
*/
if (!current_user_can(‘update_plugins’)) {
remove_action(‘admin_footer’, ‘wp_update_plugins’);
}
/**
* Disable plugin and theme editor
*/
define(‘DISALLOW_FILE_EDIT’, true);

 

请注意,这段代码的目的是禁用更新和更新提醒,以及隐藏与更新相关的一些元素。在使用之前,请确保您了解禁用更新的潜在风险,并在必要时手动检查并更新您的 WordPress 安装以保持安全。此外,最好在禁用更新之前对您的网站进行备份。

漳州网站建设  www.xmcyhd.com

联系我们

给我们打电话或填写下面的表格,我们将与您联系。我们努力在工作日的24小时内回答所有询问。