Find out in this tutorial how to hide the option to enable (or disable) automatic theme updates in WordPress using code.
WordPress 5.5 introduced quite a few new features, among them, the option to indicate that themes should be automatically updated:
If you are managing client sites you may want to hide this option from their view to avoid possible mistakes.
Luckily, there is a WordPress filter that allows you to modify this. Here’s how:
Snippet to hide the option to automatically update themes in WordPress.
Add the following code snippet to your functionality plugin:
With the first fragment you get that the option is not shown to any user.
In the second, 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 theme automatic updates.
In the snippet, your user is identified by ID=1.
If this is not your ID, please change 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 themes page.
Do you want to hide the option to modify the behavior of theme 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 for you, if you wish. A good practice if you want to avoid customer-related scares. 😉
Any questions? I read you 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. 😉