Discover in this tutorial how to hide the option to enable (or disable) automatic plugin updates in WordPress using code.
WordPress 5.5 introduced quite a few new features, among them, the option to indicate that plugins should be automatically updated.
This option is great, but if you’re managing client sites you may want to hide these options from their view to avoid potential mistakes.
Luckily, there’s a WordPress filter that allows you to modify this. Here’s how:
Snippet to hide the option to automatically update plugins in WordPress
Add the following code snippet to your functionality plugin:
With the first fragment the option is not shown for any user.
With the second one, instead, you place a conditional so that this restriction does not affect your user and, in this way, you can see the option to enable or disable automatic plugin updates.
In the snippet, your user is identified by ID=1.
If this is not your ID, replace it!
If you don’t know how to get the ID you can take a look at the tutorial on how to display the user ID in the WordPress admin.
Remember that this does not prevent updates from being done automatically (if enabled), but simply hides the option to modify it from the plugins page.
Do you want to hide the option to modify the behavior of plugin updates in WordPress? Now you know how to do it with a simple code snippet.
In fact, you can hide it for all users or leave it visible only to you, if you wish. A good option if you want to avoid customer-related scares. 😉
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉