Disabling WordPress Plugin Auto Updates

Aside from MainWP, you can login to an individual wordpress website, navigate to the Plugin page, and set Enable Auto Update on any plugin where this feature is available.

Does MainWP have an option from the MainWP console to turn OFF this feature without me having to visit each site manually?

Thanks,
John.

I’m using the File Upload extension to upload a custom plugin file to wp-content/mu-plugins/ and this file contains a few filters to change settings like this. For disabling the auto update functionality I use these filters:

/** Disable the possibility to enable automatic updates (WP 5.5) */
add_filter( 'plugins_auto_update_enabled', '__return_false' );
add_filter( 'themes_auto_update_enabled', '__return_false' );

/** Disable the possibility to enable automatic updates for WP core (WP 5.6) */
add_filter( 'allow_major_auto_core_updates', '__return_false' );
2 Likes

@josklever why not just use the Code Snippets Extension and Code-Snippets-Functions/disable-plugin-auto-updates.txt at master · mainwp/Code-Snippets-Functions · GitHub

1 Like

Because if you have a lot of sites (in my case 230 at the moment) and you want to apply a code snippet to a new site, you have to select all sites, where the snippet is removed on the existing sites and re-added to all including the new site. This process takes much more time and you can’t see which sites don’t have the snippets yet.

With the must use plugin method I can check via the Plugins page which sites don’t have the plugin or have an older version and I can upload the latest version of my plugin just to the sites that need it.

3 Likes

@josklever interesting. Thanks for the insight!

1 Like

That is a very good idea. You don’t happen to have a copy of your plugin shell as well do you? :slight_smile:

As I’ve got this question before, I’ve just added it to GitHub:

(disclaimer: I’m not an actual developer or GitHub expert, so I hope it works this way. It’s just an example for inspiration. :wink: )

4 Likes

Thanks Dennis. this is what I ended up doing. but I used @josklever suggestion with his plugin. I tested this on one site (using MainWP) to install it as an MU-Plugin. This worked great so I did it for the rest of my sites.

Cheers,
John.

1 Like

Thanks Jos,

I hope you don’t mind, I changed the name of the plugin file to something more meaningful to me and commented out the section that stops core updates. But I did leave your name in the PHP header comments.

Its working perfectly.
Cheers,
John.

1 Like

Do as you like. JKWS is the acronym of my business, and the code is just public knowledge, so I don’t have any rights to claim. It’s just meant for inspiration. :slight_smile:

The last filter doesn’t stop core updates, just the possibility to enable automatic major core updates. Minor (security) updates will still be installed automatically. And all updates can of course be installed manually or via MainWP as soon as you think it’s ready.

Awesome Jos. Thanks for sharing this.

+1 for that ‘admin_email_check_interval’ filter. That alone is golden!

Be well
Matt

3 Likes

Thank you for posting that! This has actually encouraged me to use my very first custom plugin on my own website to disable jQuery Migrate (as my first test). I am now wondering if it may be better to use custom plugins like that instead of code snippets, or if it’s better to just use code snippets instead. The benefit of a custom plugin I suppose is when I’m working inside their website I can see and disable certain functionality right away, versus having to use MainWP for that which is a pain to know what snippets are applied to any particular client site at any given time. Very interesting!!

1 Like

Both methods can be useful. It depends on your workflow and what you want to achieve.
There are a lot of code snippets here as well: Code Snippets - MainWP Community

1 Like

Great !
This is a perfect idea, thanks for this :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.