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 find solutions for the troubles.
If you show us the problem you are experiencing, we will show you how to fix it. It is that simple.

Easy WordPress automation

Switching from human control to automation is an essential step in increasing the efficiency of website development or maintenance. During the past decade, WordPress advanced a lot and became a fully functional Content Management System. Thanks to some of its internal features a large portion of its functionality could be easily automated. The following articles give ideas on how to apply successful automation:

Speed up WordPress

Speed is an important matter when it comes to website success. In order to appear on the first page except for applying the well-known SEO techniques, you will also have to pay special attention to the performance of your website. We have reviewed a number of options and prepared articles for the most important aspects that include database management and dealing with different types of content:

Extend WordPress features

Extending the standard WordPress functionality by building new features was always a hot topic. Developing themes that provide next-level User Experience could also be described similarly. Thanks to the established standards WordPress developers could create standardized extensions that can be downloaded from the official repository. In the following articles, we described some simple techniques that would help start developing your own extensions:

wppotion - powered by persistence and passion