Easy WordPress automation

WordPress resolved issues

WordPress resolved issues

WordPress comes with a number of great features that could easily be automated. In the article today we will discuss a WordPress automation and develop a little script that could be set as a cronjob and its task would be to check the plugins and themes for available updates and patch them if necessary. For many WordPress enthusiasts, manual plugins and themes upgrades are irritating and time-consuming tasks so optimizing them is a must.

WordPress automations are not only helpful when dealing with large websites and many extensions, but also small ones.

To ease the things we will use WordPress command-line interface. Our WordPress automation script will process 3 major components separately:

  • We will check the version of our application and upgrade it if its version is outdated
  • During the second stage, we will check and upgrade the plugins
  • Finally, we will check and upgrade the installed themes

Automated WordPress core files checks

WordPress version check could be easily done by typing the following command wp core version. The expected output should be similar to the following one:

# wp core version


The check the newer versions we use wp core check-update. To update the application to the latest available version we use wp core update. Right after its execution, we can again verify the version. In my case the result is:

# wp core version


WordPress plugin updates automation

A list of WordPress plugins could be generated using wp plugin list. From this moment on, we could either execute wp plugin update –all or select only the plugins that have available updates and apply patches only to them. The second option would use less server resources, especially when working with a large number of plugins. To achieve the task we will use for loop which looks like:

for i in $(wp plugin list | grep available | awk '{print $1}'); do wp plugin update $i; done

The above line reads – apply a patch for each plugin that has avialable update

WordPress theme updates automation

Similarly to the above technique, we use wp theme list to get information regarding the installed themes and updates. To refine the result we use grep and awk commands in a way to get only the themes names:

# wp theme list | grep available | awk '{print $1}'




After that, we loop through the result and apply patches. Here is how the command would look like:

for i in $(wp theme list | grep available | awk '{print $1}'); do wp theme update $i; done

Now let’s piece the details together and compile the script:


# Core update

wp core update

# Plugins update

for i in $(wp plugin list | grep available | awk '{print $1}'); do wp plugin update $i; done

# Themes update

for i in $(wp theme list | grep available | awk '{print $1}'); do wp theme update $i; done

In addition, the above easy WordPress automation could be set as a cronjob to run once a week. This way you could be sure that your application gets updated frequently.

Note that the script is not intended to generate backups before applying updates. Developing a more complex script is a subject of another article.

Do you want to share your opinion?

Your email address will not be published. Required fields are marked *


We are not industry specific. We are WordPress specific. We work with everyone to help them find solutions with their troubles.
If you show us the problem you are experiencing, we will show you how to fix it. It is that simple.

Reported WordPress issues

  1. Wordpress Rest API showing theme custom fields within the end point url are refusing to update via a post command
  2. Generate new post WordPress based on MySQL database
  3. Iframe (ads) is blur in Chrome when it is resized to fit in sidebar div
  4. How to make a WordPress page mobile responsive?
  5. Permalink Settings You should update your web.config now [on hold]
  6. how to upload image to wordpress with flutter using REST API
  7. Setting CSS property - filter: blur(x) with JS for site-inner class within genesis framework; Cannot read property 'getAttribute' of null
  8. Error on wordpress on my VPS: Your PHP installation appears to be missing the MySQL extension which is required by WordPress [on hold]
  9. Netlify deploy with results of TypeError: Cannot read property 'replace' of undefined
  10. How to position text at the same vertical level across columns

WordPress problems we are working on

  1. How to target a specific group on Buddypress (WordPress) to show it on a widget?
  2. Is it possible for Month names to be shown in my language
  3. Displaying and grouping posts
  4. Wordpress custom endpoints (WP_REST_Controller) 404 only on mobile
  5. Set default value in database [on hold]
  6. How do I programmatically set a user as spam in BuddyPress?
  7. Can i edit styling of form in ultimate member wordpress plugin?
  8. wordpress product attribute not creating automatically only work size and color other attributes not work need to add manually again same attribute
  9. Uncaught Error: Syntax error, unrecognized expression on WordPress website
  10. Wordpress website hacked and .htaccess file is creating automatically with strange code

Resolved issues

  1. Wordpress gutenberg editor gallery first image missing [on hold]
  2. how to fix the error No Input file specified on wordpress when using .php extention on pages
  3. How do I integrate Chargebee api to wordpress?
  4. Sorting a wp_query with more than one 'orderby'?
  5. Wordpress API: Sort posts by sticky and date
  6. Column background color not showing up
  7. How to show a row for each column?
  8. Wordpress site's frontend css styles not loading [on hold]
  9. Get the just added term_id (WordPress)
  10. Permalink structure does not get updated
wppotion - powered by persistence and passion