Prevent/Disable Automatic Update Check

WordPress automatically checks for updates to itself and all installed themes and plugins. This adds an annoyingly long delay to loading (any) WordPress pages. In only happens once per day and subsequent page-loads don’t do it, but it is so long, that it makes me think twice about whether it is worth opening that first page at all (especially if I only need to do a quick thing rather than spending all day in WordPress).

I only update once in a while anyway, and would much rather perform updates manually anyway, so I created a plugin to remove the Updates button from the admin bar. I thought that would do the trick, but apparently in only removes the button and the actual check is still performed in the background.

Read More

Every other program in the world lets you turn them off automatic updates, so I expect that there should be a way to do the same for WordPress, but if there is, it is a little too-well—hidden.

When I tried to find a solution, all of the questions that came up were the opposite, about finding a way to force automatic updates to actually apply (not just automatically check for updates).

How can automatic update checks be turned off in WordPress?

Related posts

4 comments

  1. How to disable core auto updates but enable plugins and themes auto
    updates

    If you want to stop the autoupdates of the WordPress core, but to
    enable them for your Plugins and/or Themes, you can add these lines in
    the wp-config.php file: Stop the core auto updates:

    define( 'WP_AUTO_UPDATE_CORE', false );
    

    Then Enable the plugins/themes:

    add_filter( 'auto_update_plugin', '__return_true' );
    add_filter( 'auto_update_theme', '__return_true' );
    

    How to completely disable the WordPress auto updates

    If you want to disable the WordPress auto updates completely, open the
    wp-config.php file and add this line to it:

    define( 'AUTOMATIC_UPDATER_DISABLED', true );
    
  2. This worked for me to disable it on localhost – which was very annoying since it’s behind a firewall and the timeout wait was huge.

    define( 'WP_HTTP_BLOCK_EXTERNAL', true );
    define( 'AUTOMATIC_UPDATER_DISABLED', true );
    define( 'WP_AUTO_UPDATE_CORE', false );
    

    Note that I’m not sure whether disabling WP_HTTP_BLOCK_EXTERNAL is necessary. I don’t recommend that you disable it on a server that requires communication with other servers.

  3. Okay, here is a solution that removes available updates, and also prevents updates checking.

    This solution assumes PHP > 5.3 (since it uses an anonymous functions)

    Part 1) Clears any existing updates:

    add_filter( 'site_transient_update_plugins',
        function ( $oUpdatesResult ) {
            if ( ! is_object( $oUpdatesResult ) ) {
                $oUpdatesResult = new stdClass();
            }
            $oUpdatesResult->response = array();
            return $oUpdatesResult;
        },
        PHP_INT_MAX
    );
    

    Part 2) Prevents the outgoing HTTP request that runs the actual check:

    add_filter( 'pre_http_request',
        function ( $bFalse, $aReqParams, $sUrl ) {
            if ( strpos( $sUrl, '//api.wordpress.org/plugins/update-check/1.1/' ) ) {
                $bFalse = null;
            }
            return $bFalse;
        },
        PHP_INT_MAX,
        3
    );
    

    Points to note:

    • WordPress only checks for updates when you load certain pages on the admin side, like the plugins page and Update page, so you’re not really gaining any performance.
    • This is only for plugins. To handle themes, repeat what you see here except where you see “plugin” replace with “theme”. I.e. in the filter name and the URL.
    • you can put this in your theme’s function.php
  4. Mark Jarquith already posted about this on his blog a while ago. Basically it just bails requests to the public SVN repos on wp dot org via the WP HTTP API filters.

    For Plugins (must get placed inside the plugin):

    add_filter( 'http_request_args', 'wpse_102554_deny_plugin_updates', 5, 2 );
    function wpse_102554_deny_plugin_updates( $r, $url )
    {
        if ( 0 !== strpos( $url, 'http://api.wordpress.org/plugins/update-check' ) )
            return $r;
    
        $plugins = unserialize( $r['body']['plugins'] );
        unset(
            $plugins->plugins[ plugin_basename( __FILE__ ) ],
            $plugins->active[ array_search( plugin_basename( __FILE__ ), $plugins->active ) ]
        );
        $r['body']['plugins'] = serialize( $plugins );
    
        return $r;
    }
    

    For Themes (must be placed inside functions.php of the theme and only works for the currently active theme):

    add_filter( 'http_request_args', 'wpse_102554_deny_theme_updates', 5, 2 );
    function wpse_102554_deny_theme_updates( $r, $url )
    {
        if ( 0 !== strpos( $url, 'http://api.wordpress.org/themes/update-check' ) )
            return $r;
    
        $themes = unserialize( $r['body']['themes'] );
        unset(
            $themes[ get_option( 'template' ) ],
            $themes[ get_option( 'stylesheet' ) ]
        );
        $r['body']['themes'] = serialize( $themes );
    
        return $r;
    }
    

    John Blackburn has written a plugin to disable theme updates.

Comments are closed.