How to install automatic updates on WordPress

Ever since WordPress 3.7, WordPress has provided the option to update certain files automatically. By default, only some updates install automatically, but others can be automatically installed if you change a few settings. If you’d rather not have to hassle with updating WordPress, plugins, and themes manually, read on to find out how to configure other WordPress automatic updates. Be aware that some of these changes require changing or writing code in WordPress files and you should proceed with caution if you’re not familiar with PHP.

Types of updates

WordPress has 4 types of updates.

  1. Core updates — This is an update to the WordPress software itself. Minor core updates (version numbers with 3 numbers, like, the current version of WordPress — 4.8.2) generally only provide security and maintenance fixes. Major core updates (version numbers with 2 numbers, like the upcoming WordPress 4.9) provide new features and other changes. Minor core updates are installed automatically by default, but major core updates are not.
  2. Plugin updates — This is an update provided by the creator of a plugin. Plugin files downloaded through the WordPress Dashboard can be updated through WordPress.
  3. Theme updates — This is an update provided by the creator of a theme. Like plugin files, theme files downloaded through the WordPress Dashboard can be updated through WordPress.
  4. Translation file updates — WordPress has a powerful translation feature called Localization. Updates to these files are installed automatically by default.

Changing default settings

Default settings are either altered with a change to the wp-config.php file or by creating a plugin.

Core updates

To change which core updates are installed automatically, you’ll need to make a change to your wp-config.php file. To do so, you’ll either need FTP access to your site or you’ll want to use your hosting provider’s tools to make direct changes to your site’s files. Be sure to back up your files before making any changes to WordPress core files.

Open wp-config.php and look for the line with WP_AUTO_UPDATE_CORE. Based on the updates you want, change the line to the following:

  • All updates (major, minor, and development updates) enableddefine ( 'WP_AUTO_UPDATE_CORE', true );
  • All updates (major, minor, and development updates) disableddefine ( 'WP_AUTO_UPDATE_CORE', false );
  • Only minor updates enabled (default setting): define ( 'WP_AUTO_UPDATE_CORE', minor );

Plugin and theme updates

Plugin and theme updates cannot be changed through wp-config.php. Instead, add the following code to your theme’s functions.php file:

  • Enable automatic updates for all themes: add_filter( 'auto_update_theme', '__return_true' );
  • Enable automatic updates for all plugins: add_filter( 'auto_update_plugin', '__return_true' );

If you want these settings to remain even if you change themes, you’ll need to create a Must-Use Plugin and place the code in it. No matter which route you take, remember to backup your files before making changes to WordPress files.

If you’re interested in changing these settings but you don’t feel comfortable making changes to your site’s code, contact us and we’ll be happy to set things up exactly how you want them.

Comments

comments