Disable WordPress Automatic Updates with Code

Jan R Dec 30, 2024 Updates
How can I stop my website from updating itself automatically?
What PHP code should I add to my `wp-config.php` file to disable automatic updates in WordPress, including core, plugin, and theme updates?
Andy answered Dec 30, 2024

Disabling WordPress Automatic Updates

Method 1: Using wp-config.php Constants

Add these constants to your wp-config.php file, just before the line that says /* That's all, stop editing! */:

// Disable all automatic updates
define('AUTOMATIC_UPDATER_DISABLED', true);

// Disable core updates
define('WP_AUTO_UPDATE_CORE', false);

// Disable theme and plugin updates and installation
define('DISALLOW_FILE_MODS', true);

Method 2: Using Filters

Add this code to your theme's functions.php file or in a site-specific plugin:

// Disable all automatic updates
add_filter('automatic_updater_disabled', '__return_true');

// Disable core updates
add_filter('auto_update_core', '__return_false');

// Disable theme updates
add_filter('auto_update_theme', '__return_false');

// Disable plugin updates
add_filter('auto_update_plugin', '__return_false');

// Disable translation updates
add_filter('auto_update_translation', '__return_false');

Method 3: Selective Control

If you want more granular control over what gets updated, add this code to your theme's functions.php file:

function custom_auto_update_control($update, $item) {
    // Allow security updates
    if ($item->type === 'core') {
        return $update;
    }
    
    // Block all other updates
    return false;
}
add_filter('auto_update_plugin', 'custom_auto_update_control', 10, 2);
add_filter('auto_update_theme', 'custom_auto_update_control', 10, 2);

Plugin Alternative

If you prefer using a plugin, these are reliable options:

Important Notes:

  1. Disabling updates can pose security risks - ensure you manually update regularly
  2. Method 1 (wp-config.php) is the most robust solution
  3. Choose only one method to avoid conflicts
  4. Always backup your site before modifying core files
  5. Keep track of available updates through WordPress.org if you disable automatic updates