Ways To Add, View And Control WordPress Cron Jobs

Ways To Add, View And Control WordPress Cron Jobs

Daily post and updates of your website stay you connected with your viewers. And to keep the connection continued you need to show activities on your website even when you are not there.

When we deal with the global audience we must take care of their daily routine. According to Coordinated Universal Time, there is an almost 24-time zone in the World. In some cases, the day-night we share are not the same. So, when you are dealing with people who do not belong to the same time zone. You need to post & update on your website according to their time zone.

Scheduling is an art of planning which acts as a filter against the distraction of a busy life. In the World of websites, WordPress is the largest using CMS and WordPress crons jobs are played a vital role to schedule your tasks.

If you want schedule feature in action use WordPress cron plugins. Here, we’re going to illustrate you how to view and control WordPress Cron Jobs for perfect scheduling.

What is WordPress Cron

The Cron is a technique that is used for commands to run on scheduled time or at regular intervals. Sometimes WordPress crons are used to maintain the server and run scheduled tasks. For example, deleting old comments from trash, checking for updates, etc.

In other words, cron is a time-based job scheduler which is originally built for Linux or Unix-based system (OS X included). These cron runs the scheduled tasks on the web server. WordPress comes with its own built-in cron which allows it to perform scheduled tasks like as publishing schedule posts, checking for updates, etc.

WordPress plugins also use crons to accomplish the tasks specified by you. For example, your WordPress Backup plugin can use WordPress cron to create check new updates automatically on a given schedule.

How WordPress Cron works

A typical Unix cron system runs in an order of “A time tied to an action occurs” and “cron runs the action tied to that time”.

While WordPress cron works a little differently like it checks each cron event to see whether the scheduled time has passed or not. Once the scheduled time for that event has passed, then WordPress cron can execute any action tied to that event.

As previously said, the cron or scheduling feature is added by plugins or by codes. Moving on the same, first, we discuss WordPress Cron plugin.

Top WordPress Cron plugins

1. WP Control plugin

WP Control plugin

WordPress offers you a WP Control plugin to view and control cron jobs in WordPress site. As an admin, you can view all cron events along with their arguments, recurrence, callback functions. You can also edit, delete and immediately run any cron events.

WP Control plugin allows you to delete bulk cron events and edit, add custom cron schedules. If your cron system doesn’t appear to be working then your admin screen will show you a warning message.

To start with plugin firstly, install the WP Control plugin and then activate it. For more info, read our guide on how to install a plugin in WordPress. After activation visits the settings of your WordPress dashboard.

How to add a new cron schedule

Here, you’ll notice that plugin adds an additional default schedule. you can also add your new cron schedule by filling the Internal name, Interval, Display name.

add schedule

Now, click on the “Add Cron Schedule” button to save your new cron schedule.

How to add a new cron event

WP Control Plugin makes it easy to add your own cron jobs to WordPress. After adding a new schedule, you can add a new cron event. Just follow the steps given below.

  • Simply go to the Tools>>Cron Events Page and scroll down to the ‘Add Cron Event’ tab.

Tools>>Cron

  • It’ll ask you for hook name for your event. The hook names cannot contain spaces or special characters.
  • If the function requires arguments that you want to execute, then you can provide those arguments. Next time when to run the cron, you have to tell the WordPress.
  • You can enter ‘now’ that will trigger cron immediately, ‘tomorrow’, ‘+2 days’, or ’25 -02-2020 12:34:00′.
  • Then, you need to choose a schedule you can choose hourly, twice daily, daily or weekly. Also, you can create it the non-repetitive event.
  • Once you’re done, then click the Add Cron Event button to store your changes.
  • You will see that your event will now appear in the event list.

Currently, it does nothing when the event is triggered until you give a command. For this, you’ll need a corresponding action hook somewhere in your code.

if ( ! wp_next_scheduled( ‘wpb_custom_cron’ ) ) {

wp_schedule_event( time(), ‘hourly’, ‘my_task_hook’ );

}add_action( ‘wpb_custom_cron’, ‘wpb_custom_cron_func’ );function wpb_custom_cron_func() {

wp_mail( ‘[email protected]’, ‘Automatic email’, ‘Automatic scheduled email from WordPress to test cron’);

}

 

  • Remember that, don’t forget to use your own email address.
  • This function sends you a test email when the cron is running. Now you can scroll up the page and test it by clicking the ‘Run Now’ link next to your event.

Sometimes, irresponsible use of WordPress Cron by the plugin can slow down your WordPress site. Specifically, if you are on shared hosting.

If a plugin frequently performs resource intensive works, you need to identify and fix the problem.

Now, move on to know the control of WordPress Crons.

How to view and control the WordPress Cron Jobs system

Let’s see how to view and control your WordPress crons with WP Control plugin.

  • First, go to the dashboard then click on Tool>>Cron Events page to control cron settings.

View and Control WordPress Cron Jobs

  • Now, you’ll see events schedule list that runs on your site by using the WordPress Cron system.
  • In the first column, you will see the name of the hook that runs the cron. Usually, Hook names give you a hint about what this particular event does. The mostly default WordPress hook starts with a wp_ prefix such as wp_update_themes, wp_update_plugins, etc.
  • However, your WordPress plugins can or cannot be used their own prefixes for their hooks. For example, Yoast SEO uses the wpseo_ prefix.
  • Also, you will see that when a cron will run next, and the time interval between the next run.
  • The last column in the list permits you to delete, edit, or run an event.

Important Note: Be very careful never delete the default WordPress cron event.

Now suppose that you see a cron event created by a WordPress plugin that quite resources intensive.

  • Then, you should check the settings of the plugin to see if there is an option to control it from there. If not, you can click on the ‘Edit’ link to change it that is next to the cron event.

View and Control WordPress Cron Jobs

  • To manage the event, you need to click on the “Edit” button. By clicking edit button it’ll open the “Modify Cron Event” tab below.
  • Now, here you can change how often you want to run the event.

View and Control WordPress Cron Jobs

  • Once you have done, click the Save Changes button to save your settings.

2. Advanced Cron Manager – debug & control

Advanced Cron Manager plugin has a rating of 5 stars with more than ten thousand active installations. The plugin supports all WordPress version. And compatible with many themes.

The plugin helps you to manage events, allow to see registered events, manually execute any events and schedule events.Advanced Cron Manager – debug & control

Advanced Cron Manager plugin allows you to copy and paste PHP implementation or each and every event. It also gives the advantage of bulk integration. On blocking the WP Cron spawning and get step instruction to setup server Scheduler. You need to enable Javascript to edit accordingly schedule.

Pro version of the plugin includes Cron Logger, Error catcher, performance stats, and debug tool.

3. WP-Cron Control

WP-Cron Control plugin has a rating of 4.5 stars and more than nine thousand active installations. Compatible with the maximum number of themes and support almost all version of WordPress.

The plugin is perfect for those sites that either doesn’t get enough comments that ensure a regular execution of wp-corn or the wp-corn is not properly controlled by the regular method and causing repeated execution of Wp-corn at the same time. WP-Cron Control also helps in posts that missed their schedule.

CONCLUSION

Scheduling post always keeps you a step forward from others. It shows that your site is still in action even you are not able to reach the admin panel. WordPress Crons jobs specifically work for the scheduling process of your website.

The blog is an effort to summarize the WordPress Cron jobs and how to setup them properly.

You may take time to understand, but once you understand then you are able to control WordPress cron jobs of your site.

Hope! This post will help you. If you like the content please like and share with others also. Share your views in the comment section. We love to hear from you.

Still, you are facing any query related to this guide, you can call us on our Toll-Free no +18886140555. Our WordPress Support team is always there to help you.



Leave a Reply