What Are WP Auto Updates in WordPress?
WP Auto Updates in WordPress allow the platform to automatically update its core software, as well as plugins, themes, and translation files, without requiring manual user input.
How WP Auto Updates Work
WordPress Auto Updates are executed using the WP Cron system, which runs twice daily at predefined times to check for available updates. The process begins with the wp_version_check action, which initiates a chain of checks.
If updates are available, the wp_maybe_auto_update action triggers the download and installation processes. Key safeguards, like a database lock, prevent simultaneous update attempts during this process.
Types of WP Auto Updates
- Core Updates: Core updates are divided into minor and major releases. Minor updates, which include maintenance and security patches, are enabled by default. Major updates, which often feature new functionality or structural changes, require manual activation of the automatic update setting.
- Plugin Updates: Automatic updates for plugins are disabled by default. This behavior can be modified through the WordPress dashboard or by applying the auto_update_plugin filter for specific plugins.
- Theme Updates: Similar to plugins, themes do not update automatically unless the setting is enabled manually or through filters.
- Translation File Updates: Translation file updates are part of minor core updates and are automatically installed.
Enabling or Disabling WP Auto Updates
Automatic updates can be managed using constants, filters, or the WordPress dashboard. The DISALLOW_FILE_MODS or AUTOMATIC_UPDATER_DISABLED constants can fully disable automatic updates.
Alternatively, the automatic_updater_disabled filter can be used to stop updates while applying finer control.
To enable or disable updates for specific plugins or themes, developers can utilize dedicated filters. For example, returning true via the auto_update_plugin filter will enable updates for a particular plugin, while returning false will disable it.
Since WordPress version 5.5, users can directly manage automatic updates for plugins, themes, and core releases from the admin interface’s Updates section.
Update Safety and Dependencies
Before processing any automatic update, WordPress performs a series of checks to ensure site stability. These include assessing filesystem permissions for update write access and determining if the auto-update system is disabled.
Filters attached to different stages of the update process allow customization of behaviors, providing an additional layer of control.
Risks and Drawbacks
Automatic updates, while convenient, can introduce risks:
- Compatibility issues can arise between plugin or theme updates and existing site configurations, potentially breaking site functionality.
- Sites relying on custom code may face unintended overwrites if the custom code’s files share the same name as repository-distributed plugins or themes.
- WordPress auto updates do not create backups by default, which could complicate recovery efforts if an update causes issues.
Best Practices for WP Auto Updates
For safe and efficient use of WP Auto Updates:
- Implement a reliable backup system to create restore points before updates are applied.
- Avoid using generic naming conventions for custom code to prevent overwrites.
- Use a staging site to test updates before they are applied to the live environment.
- Monitor update logs to quickly address issues arising from failed automatic updates.
Managed Hosting and Auto Updates
Many managed hosting providers configure their platforms to enforce auto-updates for core, plugins, and themes unless site administrators disable the behavior manually.
These setups often include additional safeguards, such as automatic backups, to mitigate potential risks associated with automatic updates.