How to schedule cron jobs with WordPress website

| Last Updated: | In: WordPress, WordPress Beginners, WP Labs


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.

cronjob-with-wordpress

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!

Download

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.

cronjob-scheduler-screenshot-1

cronjob-scheduler-screenshot-2

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.

Tags: , , , , , , , , , , ,


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby.


You may also like:

Follow us!

Get Free Access of 380+ Scripts

Don't worry you'll not be spammed!

Featured eBook

WordPress Security Guide

Free Guide: Learn how to implement security guideline in your WordPress site...

DOWNLOAD

Pincode Finder

pincode-finder tool

Online Pincode Finder

Best tool to locate post Office address and pincodes of all india...

SEARCH NOW
Copyright © 2013-2017