Automated Tasks
for
By Joe Cartonia
About me
Name: Joe Cartonia
GitHub: https://github.com/cssjoe
Twitter: @joemotocss
I am a Buffalo native working in Virginia Beach as a WordPress plugin and API developer
for BoldGrid since 2014. I have been a WordCamp speaker a few times (Buffalo &
Rochester, NY), and have presented at some WordPress meetups. Technology
(electronics, computer hardware and software) has always been a major interest of mine
since the first grade. I also enjoy traveling, motorsports, snowboarding, playing guitar,
and spending time at the beach.
Topics covered in this presentation
● Using the Linux system cron instead of the default WP-Cron
● Automated backups
● Remote backup storage
● Automated updates
WP-Cron vs. System Cron
WordPress uses an internal task scheduler called WP-Cron. Tasks are scheduled and
completed when the items become due.
WP-Cron can be inefficient, as it checks the task event list when visitors load pages on
the site. High-traffic sites may see reduced performance and higher server load due to
the WP-Cron checks. It is recommended to switch to a system task/cron scheduler.
System cron schedulers (such as the Linux system cron) execute tasks on the exact
specified times, down to the minute. Some conditions can delay the actions, such as high
server load.
Using system cron instead of WP-Cron
Disable WP-Cron by modifying the wp-config.php file.
https://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-
in-wordpress
Add the following line to the wp-config.php file to disable WP-Cron:
define('DISABLE_WP_CRON', true);
After the file is saved, the WP-Cron system will not be triggered by site page loads.
Using system cron instead of WP-Cron
A system cron job can be added using cPanel, SSH (shell/terminal), or possibly other web
hosting panel software.
The following support article walks through the process:
https://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress
cPanel:
Under the Advanced section, click on Cron Jobs.
Select Once per hour from the Common Settings drop-down.
Now select Every Sixth hours from the Hour drop-down.
Finally fill in the code to run our cron job and click Add New Cron Job.
cd /home/userna5/public_html; php -q wp-cron.php
Using system cron instead of WP-Cron
A cron job can be added using SSH and the crontab command-line utility.
Login to SSH and run the following command to edit your crontab file (schedule):
crontab -e
In the editor, add the following line (changing your username and path):
0 */6 * * * cd /home/userna5/public_html; php -q wp-cron.php
Save the file.
The task will run at the top of the next sixth hour, and every six hours.
Performing Site Backups
One of the highest-recommended tasks for a site administrator is to perform regular
backups.
It is also recommended to store backups in an off-site location.
Backups can be performed manually or automatically.
Most site administrators backup their site using either a WordPress plugin or their web
host software (such as cPanel or Softaculous).
Using a plugin to automate backups
There are many backup plugins that can be installed from the WordPress.org plugin directory,
such as BoldGrid Backup.
https://wordpress.org/plugins/boldgrid-backup/
It is easy to install plugins and configure automatic backups.
● Login to your WordPress
● Go to Plugins >> Add New
● Search for "BoldGrid Backup"
● Click "Install Now", and then click on "Activate".
● Navigate to BoldGrid Backup >> Settings
● Select your Days of the Week, Time of Day, Backup Storage location, and click Save Changes.
Backups will complete on the schedule that you choose.
Backup Storage Locations
BoldGrid Backup can store backup archives on the local web server as well as remote
locations. The free version also supports FTP or SFTP (vis SSH). The premium version
supports other remote storage locations, such as Google Drive and Amazon S3.
If you do perform backups that are stored on the local web server and the software does
not provide a way to copy/move the backups to a remote location, then you can do it
manually or write a script or cron job to do it for you.
Automated Updates
There are WordPress plugins available that can perform auto-updates for plugins and themes.
Some of which include BoldGrid Backup, Jetpack, and Automatic Plugin Updates. It is also
possible to enable automatic core updates in the wp-config.php file and plugin/theme updates
using a filter function inside of your own must-use plugin.
To configure the settings yourself, you can follow the steps in the following WordPress article:
https://wordpress.org/support/article/configuring-automatic-background-updates/
Q & A
Please ask any questions that you may have.
Thank you!
I would like to thank everyone for attending.
Please follow me on Twitter: @joemotocss
This slideshow and others are available at: https://www.slideshare.net/JoeCartonia/

Automated Tasks for WordPress

  • 1.
  • 2.
    About me Name: JoeCartonia GitHub: https://github.com/cssjoe Twitter: @joemotocss I am a Buffalo native working in Virginia Beach as a WordPress plugin and API developer for BoldGrid since 2014. I have been a WordCamp speaker a few times (Buffalo & Rochester, NY), and have presented at some WordPress meetups. Technology (electronics, computer hardware and software) has always been a major interest of mine since the first grade. I also enjoy traveling, motorsports, snowboarding, playing guitar, and spending time at the beach.
  • 3.
    Topics covered inthis presentation ● Using the Linux system cron instead of the default WP-Cron ● Automated backups ● Remote backup storage ● Automated updates
  • 4.
    WP-Cron vs. SystemCron WordPress uses an internal task scheduler called WP-Cron. Tasks are scheduled and completed when the items become due. WP-Cron can be inefficient, as it checks the task event list when visitors load pages on the site. High-traffic sites may see reduced performance and higher server load due to the WP-Cron checks. It is recommended to switch to a system task/cron scheduler. System cron schedulers (such as the Linux system cron) execute tasks on the exact specified times, down to the minute. Some conditions can delay the actions, such as high server load.
  • 5.
    Using system croninstead of WP-Cron Disable WP-Cron by modifying the wp-config.php file. https://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp- in-wordpress Add the following line to the wp-config.php file to disable WP-Cron: define('DISABLE_WP_CRON', true); After the file is saved, the WP-Cron system will not be triggered by site page loads.
  • 6.
    Using system croninstead of WP-Cron A system cron job can be added using cPanel, SSH (shell/terminal), or possibly other web hosting panel software. The following support article walks through the process: https://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress cPanel: Under the Advanced section, click on Cron Jobs. Select Once per hour from the Common Settings drop-down. Now select Every Sixth hours from the Hour drop-down. Finally fill in the code to run our cron job and click Add New Cron Job. cd /home/userna5/public_html; php -q wp-cron.php
  • 7.
    Using system croninstead of WP-Cron A cron job can be added using SSH and the crontab command-line utility. Login to SSH and run the following command to edit your crontab file (schedule): crontab -e In the editor, add the following line (changing your username and path): 0 */6 * * * cd /home/userna5/public_html; php -q wp-cron.php Save the file. The task will run at the top of the next sixth hour, and every six hours.
  • 8.
    Performing Site Backups Oneof the highest-recommended tasks for a site administrator is to perform regular backups. It is also recommended to store backups in an off-site location. Backups can be performed manually or automatically. Most site administrators backup their site using either a WordPress plugin or their web host software (such as cPanel or Softaculous).
  • 9.
    Using a pluginto automate backups There are many backup plugins that can be installed from the WordPress.org plugin directory, such as BoldGrid Backup. https://wordpress.org/plugins/boldgrid-backup/ It is easy to install plugins and configure automatic backups. ● Login to your WordPress ● Go to Plugins >> Add New ● Search for "BoldGrid Backup" ● Click "Install Now", and then click on "Activate". ● Navigate to BoldGrid Backup >> Settings ● Select your Days of the Week, Time of Day, Backup Storage location, and click Save Changes. Backups will complete on the schedule that you choose.
  • 10.
    Backup Storage Locations BoldGridBackup can store backup archives on the local web server as well as remote locations. The free version also supports FTP or SFTP (vis SSH). The premium version supports other remote storage locations, such as Google Drive and Amazon S3. If you do perform backups that are stored on the local web server and the software does not provide a way to copy/move the backups to a remote location, then you can do it manually or write a script or cron job to do it for you.
  • 11.
    Automated Updates There areWordPress plugins available that can perform auto-updates for plugins and themes. Some of which include BoldGrid Backup, Jetpack, and Automatic Plugin Updates. It is also possible to enable automatic core updates in the wp-config.php file and plugin/theme updates using a filter function inside of your own must-use plugin. To configure the settings yourself, you can follow the steps in the following WordPress article: https://wordpress.org/support/article/configuring-automatic-background-updates/
  • 12.
    Q & A Pleaseask any questions that you may have.
  • 13.
    Thank you! I wouldlike to thank everyone for attending. Please follow me on Twitter: @joemotocss This slideshow and others are available at: https://www.slideshare.net/JoeCartonia/