How to schedule cron jobs with WordPress website

In this tutorial i will explain how to schedule cron jobs with WordPress website. The cron is a time-based task/job scheduler which is running after a time intervals as per your settings during creating cron job in unix based operating systems. It is typically automates your several tasks/jobs.

Just assume if you need to export data from your database every hours, then you are doing it’s manually. In this case you can schedule cron jobs for doing this task automatically. First write your PHP script to export data from respective database and schedule cron job by using wp_schedule_event() WordPress function.


wp_schedule_event() WordPress action will trigger when one hour passed and executed your PHP script and export your data from database. In the below you snippets do_this_hourly() function will execute your PHP code. Add below code at the end of the current activated theme’s functions.php file.

Schedule cron jobs with Cronjob Scheduler

You ca also schedule your cron job using Cronjob Scheduler WordPress plugin. It is the best WordPress plugin to schedule your cronjobs in your WordPress websites. It will allow you to run your tasks timely and frequently without visit your website, all you need is at least 1 action and a Unix Crontab schedule!


How to setup Cronjob Scheduler

Download the latest version of plugin from WordPress plugin directory and upload it in wp-content/pluigns folder after unzip the zip file. Now go the the Dashboard => Plugins and activate the Cronjob Scheduler plugin to enable it’s features. Below is the screenshots to configure the Cronjob Scheduler WordPress plugin.



wordpress cron job plugin

Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Article Tags: , , , , , , , , , , ,