This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
automatic_updater_disabled Filter
Perhaps you’ve experienced the frustration of losing theme or plugin customizations due to automatic updates in WordPress. If so, you’re not alone. Many users have encountered these challenges, emphasizing the importance of disabling automatic updates. In this post, I’ll guide you through the simple process of turning off automatic updates, a highly recommended practice for a smoother WordPress experience.
How to Disable Automatic Updates in WordPress
There are two ways to disable the automatic updates in WordPress.
Using wp-config.php
The first is defining AUTOMATIC_UPDATER_DISABLED constant in wp-config.php.
define('AUTOMATIC_UPDATER_DISABLED', true);
Using automatic_updater_disabled Filter
The second way is using the automatic_updater_disabled filter and returning true to stop automatic updates.
To use automatic_updater_disabled filter, first you have to register it using add_filter. You can write this code into functions.php of your activated theme or in a custom WordPress Plugin.
We at WePlugins always prefer to create a custom WordPress Plugin while using hooks so nothing breaks when you update your WordPress Theme in the future.
Live Example 1: Basic Usage
In the below live example, we have defined a function weplugins_modify_automatic_updater_disabled_defaults which takes 1 parameter and we registered it using add_filter. The first parameter automatic_updater_disabled is the name of the hook, the second parameter weplugins_modify_automatic_updater_disabled_defaults is the name of the function which needs to be called, the third parameter is the priority of calling the hook if the same hook is used multiple times, and the last parameter is the number of arguments (if any) to be passed in the registered function.
function weplugins_modify_automatic_updater_disabled_defaults($disabled) { return true; } add_filter("automatic_updater_disabled", "weplugins_modify_automatic_updater_disabled_defaults", 10, 1);
Live Example 2: Conditional Disable
If you need to disable automatic updates conditionally, you can modify the $disabled variable based on your requirements.
function weplugins_modify_automatic_updater_disabled_conditionally($disabled) { if (some_condition()) { return true; } return $disabled; } add_filter("automatic_updater_disabled", "weplugins_modify_automatic_updater_disabled_conditionally", 10, 1);
Live Example 3: Removing the Filter
To remove a hook callback, use the example below. Please make sure to provide the same callback function name, priority, and number of arguments while removing the hook callback.
remove_filter("automatic_updater_disabled", "weplugins_modify_automatic_updater_disabled_defaults", 10, 1);
Parameters
Below is the 1 parameter required to use this hook.
- $disabled: (bool) Whether the updater should be disabled.
If you’re having any trouble using this hook or need customization, please contact us and we’d be happy to assist you.
Explore the latest in WordPress
Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.