0

Why exactly does Wordpress 4.0.1 want to upgrade to 4.1 automatically?

To be specific, I see in wp_options table, in option with name

_site_transient_update_core, a serialized array with an update, AND an autoupdate:

...O:8:"stdClass":11:{s:8:"response";s:10:"autoupdate";s:8:"download";s:57:"https://downloads.wordpress.org/release/wordpress-4.1.zip";s:6:"locale";s:5:"en_US";s:8:"packages";O:8:"stdClass":5:{s:4:"full";s:57:"https://downloads.wordpress.org/release/wordpress-4.1.zip";s:10:"no_content";s:68:"https://downloads.wordpress.org/release/wordpress-4.1-no-content.zip";s:11:"new_bundled";s:69:"https://downloads.wordpress.org/release/wordpress-4.1-new-bundled.zip";s:7:"partial";b:0;s:8:"rollback";b:0;....

Why exactly is a major upgrade an auto-update this time? I don't even have a WP_AUTO_UPDATE_CORE in my wp-config.

0

2 Answers 2

2

The "autoupdate" value you see there is just a string in the "response" field from the version check API call. It doesn't determine whether or not your site actually performs an autoupdate. You'll see that field in every response returned from core version checks. Basically, it's just saying that a potential autoupdate is available for download.

The WordPress updater actually has a function called should_update_to_version() which determines whether or not WordPress performs the update. Because ultimately, the API server isn't doing the update for you, your own install of WordPress is doing that. The should_update_to_version() function uses a combination of various defines, filters, and defaults to determine whether or not it should do an update in a wide variety of circumstances.

For example, minor updates (4.0 -> 4.0.1) are enabled by default. Major updates (4.0 -> 4.1) are disabled by default. But there are more variations on that theme. Beta versions, such as 4.1RC1 will update to to their release versions by default. If you use pre-release versions for testing, like the upcoming 4.2-alpha or whatever it will be called, then you may want auto-updates to the latest nightly releases. Things like that. So the function is a bit more complex than it first appears.

If you have not changed the defines, and you don't have any plugins or themes that are using the various filters to change the way the updater works, then WordPress will not update itself from 4.0.1 to 4.1 automatically. Check to see if you have any plugins or other code that modifies the core update mechanisms.

Additionally, some hosts may be doing the updates for you. Ask your host if they have any such systems.

2
  • Thanks! It does seem a bit odd though, that that function has filters like 'allow_major_auto_core_updates'. When someone needs to filter these to prevent their system updating to a specific version, it would always break if it's an auto-update, because wp-cron directly calls wp-cron.php => wp-includes/plugin.php => wp-includes/update.php. So no plugin/theme can actually filter this, correct? In other words, if theoretically a plugin needed to prevent auto-update from x.0.1 to x.0.2, the only way to do so would be to filter the pre-set-transient value filter?
    – NoBugs
    Dec 20, 2014 at 16:39
  • No, because calling wp-cron won't perform an update unless one is added previously by the aforementioned functions.
    – Otto
    Dec 21, 2014 at 3:06
2

In WordPress, there are four types of automatic background updates:

  • Core updates
  • Plugin updates
  • Theme updates
  • Translation file updates

If you don't like this, then add the constant to deactivate this feature in the wp-config.php, that it works on a default install.

Constant to Disable All Updates

define( 'AUTOMATIC_UPDATER_DISABLED', TRUE );

Constant to Configure Core Updates

define( 'WP_AUTO_UPDATE_CORE', FALSE );

Alternative via Plugin

As an alternative use a plugin to set your requirements to the update feature, like

More

You find a lot of more information about the update and his hooks, features, constants on the codex page - http://codex.wordpress.org/Configuring_Automatic_Background_Updates

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.