Celebrate International Yoga Day with us and get a flat 20 to 30% discount on products. Offer valid till 24 June. Use code: INTYoga24
How can we help?

Cron Job

“Cron Job is a time-based job scheduler.” It is a system that enables users to implement commands, programs, and other actions at a particular time.

Basically in an era where a customer has a lot of options to choose from, it becomes necessary that a brand keeps up with its presence, Hence, the recalling feature should definitely be on your priority list.

Why Cron job?

Cron Job is a system that schedules an action to take place at a specific time in the future without actually having someone to perform it. Hence, it runs on an automated form.

In order to automate, Word press uses a file known as wp-cron.php as a virtual cron job, for performing tasks:

  • That occur at regular intervals.
  • That occur once at a fixed time.

Examples of tasks occur at regular intervals:

  • Website Backup.
  • Ensuring WordPress is in it’s latest version.
  • Ensuring plugins and themes are up to date.
  • Database optimization for performance improvement.

Examples of tasks occurring at a fixed time.

  • Posting a blog post at a particular time.
  • Email outburst at a specific time.

The WordPress cron system without code can be configured and operated. Let us explore how!

The first thing we need to do is install and activate the WP Control plugin.

  • Log in to the Admin Panel.
  • Go to WP Admin >> Plugins >> Add new. Find for WP Control or directly download from here.
    Wp Event Manager Cron Job 1
  • Install the plugin.
  • After the plugin is installed and activated, Go to the Installed plugin menu and search for the WP control plugin and click on Cron Event.
    Wp Event Manager Cron Job 2
  • Find your scheduled actions in the Cron events section of the tools list.
    Wp Event Manager Cron Job 3

Adding Cron Events in WordPress

In order to add cron jobs to WordPress one needs to go to Tools » Cron Events page and scroll down to the ‘Add Cron Event’ tab.

You can now customize your own cron event in WordPress:

  • Add a hook name to your cron event.
  • Provide arguments, if the function you want to execute requires it.
  • Then  inform WordPress about when to run the cron next time. You can enter ‘now’, ‘tomorrow’, ‘+4 days’, or a specific date, ’25-02-2020 12:34:00′.
  • Lastly, select the schedule. It may be hourly, thrice daily, daily, or once a week. You can also make it a non-repeating event.
  • Next, save the changes by clicking on the Add Cron Event button.
  • The cron event will now appear in the events schedule list.
  • However, the task does not end here as we haven’t told WordPress what to do when this event is triggered.
  • Therefore, add your hook and function that runs when the cron hook is triggered.
  •     add_action( 'wpb_custom_cron', 'wpb_custom_cron_func' );
          function wpb_custom_cron_func() {
          wp_mail( 'you@example.com', 'Automatic email', 'Automatic scheduled email from WordPress to test cron');
  • Test the function now!
Cron Job
Ashok Dudhat

Our team constantly explores ways that technology can help us reinvent industries. We want to change the world by creating great products that transform industries. We Dream It, We Make It.

Quick Links