9

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.

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?

6
  • Have you read this? Commented Jun 10, 2013 at 18:49
  • Also see the update here wordpress.stackexchange.com/questions/67945/… , it causes a PHP warning but I forget why. Commented Jun 10, 2013 at 19:03
  • Also, review instructions of this WP codex: codex.wordpress.org/Configuring_Automatic_Background_Updates Commented Jan 24, 2014 at 1:16
  • related question: wordpress.stackexchange.com/questions/120081/… Commented Mar 27, 2014 at 20:31
  • The information about automatic background updates in 3.7 weren’t what I was talking about (I’m still using 3.5—I’m avoiding updating until the post formats thing is sorted out because I often want to post just a single photo or sentence, not a whole post). However, the question about dashboard update notifications is definitely related. When I get my portable web-server up and running again, I’ll test that. Commented Mar 28, 2014 at 1:40

5 Answers 5

5

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.

4

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 ); 
1
  • 4
    This does not prevent WP from checking the updates. Commented Apr 10, 2015 at 8:14
2

Following code will disable auto update check on wordpress admin. You can add it to your theme's functions.php file.

remove_action('admin_init', '_maybe_update_core'); remove_action('admin_init', '_maybe_update_plugins'); remove_action('admin_init', '_maybe_update_themes'); 
1

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
1
  • What should be changed to disable core update check? Commented Aug 20, 2020 at 11:36
0

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.

1
  • I think the snippets will not work. Since WordPress 3.7 works the API with a JSON String. The function serialize can't work with JSON, use as alternative json_decode and json_encode. The the follow gist for the completely source - gist.github.com/bueltge/5a3545ada7e68d367424 Commented Jul 6, 2014 at 12:22

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.