Speeding up the WordPress admin panel — disabling aggressive update checks

In my opinion, this is a must-have feature for all WordPress sites, as they say - a must-have. Why? Because update checks should run in the background and no other way, with very rare exceptions! Let's figure out what's what.

To completely disable auto-updates for the core, themes, and plugins, read a separate article: Auto-updates in WordPress.

The reason for slowdowns in the admin panel

I think everyone who is more or less connected with WordPress has noticed occasional slowdowns when accessing any admin page: in the admin console, on the plugins or themes page (especially here!). These slowdowns occur periodically: sometimes slow, sometimes fast.

This happens because of WordPress checks for new versions: core, plugins, themes, and translations.

The point is that to check for new versions, PHP sends an HTTP request when generating the page, or more precisely, 3 requests: core, theme, plugins. If there are paid plugins, then there is usually one more request for each plugin. When an HTTP request is sent in PHP, the page generation hangs until each request receives a result, and on average, each request takes 0.3 - 1 second. So, the page hangs for 2-4 seconds.

The frequency of these checks on different admin pages is as follows:

  • On the "Dashboard Updates" page - every minute.
  • On the "Plugins" or "Appearance > Themes" page - every hour.
  • On any page in the admin panel - every 12 hours (twice a day).

In addition, these checks are triggered during the 'admin_init' event, which means during AJAX requests. Despite the fact that this happens once every half a day, it is still unpleasant when someone catches an AJAX request with a 3-second delay... Moreover, this behavior for AJAX requests also works in the frontend, and this is already very bad...

Frontend and admin panel

In the frontend, all checks run on cron and are triggered in the background from there. When a user visits the site, WP runs cron (with a certain frequency), and does it without delays (in the background). If it's time to check in the cron task, then it happens... Everything is fine in the frontend and nothing slows down.

In the admin panel, "aggressive checking" occurs not in the background, but directly when generating the page. It is done so that when we enter the admin panel, we immediately see in the menu that there are updates. If there were a background check, then to see the presence of updates, we would need to visit the page again. If I compare this drawback with slowdowns, I definitely choose it!

Slowdowns and object caching

If a site has an object caching plugin installed, the situation with slowdowns only worsens. Because when object caching is used, there are no temporary options in the database - everything is written to the cache, and when this cache is cleared, everything is cleared, including data about the last check for new versions: core, plugins, themes, and translations.

Thus, clearing the object cache results in a 3-second delay on any admin page. During development, it is often necessary to clear the object cache, and every time after clearing, the page takes 3-4 seconds to load shout

Solution (disabling slowdowns)

To get rid of slowdowns, but at the same time not completely disable update checks. Insert the following code into the theme's functions.php file, or wherever you insert such codes...

This code completely disables "aggressive" update checks in the admin panel. But it does not affect update checks via cron. Also, if you need to check for new versions right now, go to the "Dashboard > Updates" page - there the "aggressive" check is not disabled and runs every minute...

That's how everything should work, in my opinion, out of the box. But WP has "overdone" with updates... Maybe they will change it in the future, although I doubt it... But for now:

GitHub
<?php

/**
 * Disable forced checking for new WP, plugins, and theme versions in the admin panel,
 * so that it doesn't slow down when you haven't visited for a long time and then visit...
 * All checks will happen unnoticed through cron or when you visit the "Dashboard > Updates" page.
 *
 * @see https://wp-kama.ru/filecode/wp-includes/update.php
 * @author Kama (https://wp-kama.ru)
 * @version 1.1
 */
if( is_admin() ){
	// disable update checks when entering the admin panel...
	remove_action( 'admin_init', '_maybe_update_core' );
	remove_action( 'admin_init', '_maybe_update_plugins' );
	remove_action( 'admin_init', '_maybe_update_themes' );

	// disable update checks when entering a special page in the admin panel...
	remove_action( 'load-plugins.php', 'wp_update_plugins' );
	remove_action( 'load-themes.php', 'wp_update_themes' );

	// leave forced checking when entering the updates page...
	//remove_action( 'load-update-core.php', 'wp_update_plugins' );
	//remove_action( 'load-update-core.php', 'wp_update_themes' );

	// leave forced checking when entering the "Update/Install Plugin" or "Update/Install Theme" page - it doesn't interfere...
	//remove_action( 'load-update.php', 'wp_update_plugins' );
	//remove_action( 'load-update.php', 'wp_update_themes' );

	// don't touch the cron event, it will be used to check for updates - everything is fine here!
	//remove_action( 'wp_version_check', 'wp_version_check' );
	//remove_action( 'wp_update_plugins', 'wp_update_plugins' );
	//remove_action( 'wp_update_themes', 'wp_update_themes' );

	/**
	 * disable the need to update the browser in the console - we always use top browsers!
	 * this check happens once a week...
	 * @see https://wp-kama.ru/function/wp_check_browser_version
	 */
	add_filter( 'pre_site_transient_browser_'. md5( $_SERVER['HTTP_USER_AGENT'] ), '__return_empty_array' );
}

Plugin

A plugin was created based on the code from this article: Disable Aggressive Updates.