Keeping WordPress plugins updated is essential for security, stability, and overall site performance. Many site owners, however, avoid enabling full automatic updates because major releases often introduce new features, structural changes, or deprecated code that can break a production environment. Minor and patch updates are typically safer because they focus on bug fixes and security enhancements.
WordPress does allow you to modify its auto-update behavior, but it does not distinguish between major, minor, and patch releases. A major version change (for example, going from 2.x to 3.x) carries the highest risk, while minor and patch changes (such as 2.3.4 to 2.4.0 or 2.3.5) are generally low-impact. The following snippet adds this missing control by checking the currently installed version and comparing it to the available update. If the major version differs, the update is skipped; otherwise, it proceeds.
This approach creates a predictable update workflow: let WordPress handle incremental, low-risk updates automatically while you manually evaluate major releases on a staging site.
To use it, create a file named auto-update-plugin.php inside wp-content/mu-plugins and add the following code:
<?php
/**
* Auto-update plugins for minor/patch versions only.
*/
add_filter( 'auto_update_plugin', function ( $update, $item ) {
if ( ! isset( $item->new_version ) || ! isset( $item->plugin ) ) {
return $update;
}
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$all_plugins = get_plugins();
if ( ! isset( $all_plugins[ $item->plugin ] ) ) {
return $update;
}
$current_version = $all_plugins[ $item->plugin ]['Version'];
$new_version = $item->new_version;
$current_parts = explode( '.', $current_version );
$new_parts = explode( '.', $new_version );
// If Major version differs, block update.
if ( isset( $current_parts[0], $new_parts[0] ) && $current_parts[0] !== $new_parts[0] ) {
return false;
}
// Otherwise, allow it.
return true;
}, 10, 2 );
This filter runs for each plugin update. It loads the installed version, compares only the major portion of the version string, and decides whether the update should run. Automatic updates remain active for minor and patch releases, while major upgrades stay fully manual. Always keep backups and review changelogs, as some plugins do not follow strict versioning conventions.
