It’s important to keep your WordPress installation and plugins up to date. This is one of the primary security measures to mantaining a website. Known vulnerabilities in plugins are often the target for many hacks.
Updating websites CMS and plugins should be a routine job. However the job can become very tedious especially when dealing with multiple websites, all with multiple plugins which release updates frequently. This article shows you how to use a handy WordPress feature which allows you to automate this process.
Copy and paste the code below into your functions.php
function auto_update_specific_plugins ( $update, $item ) { // Array of plugin slugs to always auto-update $plugins = array ( 'akismet', 'js_composer', 'contact-form-7', 'duplicate-page', 'captcha', 'syntaxhighlighter', 'tinymce-advanced' ); if ( in_array( $item->slug, $plugins ) ) { return true; // Always auto-update plugins in this array } else { return $update; // Else, use the normal API response to decide whether to update or not } } add_filter( 'auto_update_plugin', 'auto_update_specific_plugins', 10, 2 );
Update the list of plugin slugs to your plugins that you would like to auto-update.
$plugins = array (
‘akismet’,
‘js_composer’,
‘contact-form-7’,
‘duplicate-page’,
‘captcha’,
‘syntaxhighlighter’,
‘tinymce-advanced’
);
The easiest way to find your plugin SLUGS is to:
-
- Go to the Plugins page.
- Right click on View details
- Click Copy link address
4. Paste link into any text editor.
5. The ‘akismet’ part of the URL is the plugin SLUG.
That’s all there is too it! Now you can set and forget. You can be happy now that your plugins will always be up to date.