Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to View and Control WordPress Cron Jobs

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Recently, one of our readers asked if it was possible to view and control the WordPress cron job system in the dashboard.

Cron is a technology to run scheduled tasks on web server. WordPress comes with its own built-in cron that allows it to perform scheduled tasks such as checking for updates, publishing scheduled posts, etc.

In this article, we will show you how to view and control WordPress cron jobs.

What is WordPress Cron? How it Works?

Cron is a technical term used for commands to run on scheduled time or at regular intervals. Most web servers use it to maintain the server and run scheduled tasks.

WordPress comes with its own cron system which allows it to perform scheduled tasks. For example, checking for updates, deleting old comments from trash, publishing scheduled posts, and so on.

WordPress plugins can also use it to perform tasks specified by you. For example, your WordPress backup plugin can use WordPress cron to automatically create backups at given schedule.

However, irresponsible use of WordPress cron by plugins can slow down your website. Especially, if you are on shared hosting.

If a plugin frequently performs resource intensive tasks, then you need to identify the issue and fix it.

Let’s take a look at how to view and control the WordPress cron system without writing any code.

View and Control WordPress Cron System

First thing you need to do is install and activate the WP Crontrol plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools » Cron Events page to control cron settings.

WordPress Cron events

You will see a list of all cron events scheduled to run on your site using the WordPress cron system.

In the first column, you will see the name of the hook that runs the cron.

Hook names usually give you a hint at what this particular event does.

Most default WordPress hooks begin with a wp_ prefix, like wp_update_plugins, wp_update_themes, etc.

Your WordPress plugins may or may not use their own prefixes for their hooks. For example, All in One SEO uses aioseo_ prefix.

You will also get to see when a cron will run next, and the time interval between next run.

The last column on the list allows you to edit, delete, or run a cron event.

Important: Be very careful about what you do with cron events and never delete a default WordPress cron event.

Now, let’s suppose you see a cron event created by a WordPress plugin that is quite resource intensive.

First, you should check the plugin’s settings to see if there is an option to control it from there. If there isn’t, then you can click on the ‘Edit’ link next to the cron event to change it.

Editing a cron in WordPress

Clicking on the Edit button will open the ‘Modify Cron Event’ tab down below.

Here you can change how often you want the event to run.

Modifying cron settings

Once you are done, click on the ‘Modify Cron Event’ button to store your settings.

Adding Your Own Cron Events in WordPress

WP Control plugin makes it easy to add your own cron jobs to WordPress. Simply visit Tools » Cron Events page and scroll down to ‘Add Cron Event’ tab.

Add custom cron event in WordPress

First, you need to provide a hook name for your cron event. Hook names cannot have spaces or special characters.

If the function you want to execute requires arguments, then you can provide those arguments.

Next, you need to tell WordPress when to run the cron next time. You can enter ‘now’ which will trigger cron immediately, ‘tomorrow’, ‘+2 days’, or ’25-02-2020 12:34:00′.

Lastly, you need to select a schedule. You can select hourly, twice daily, daily, or once a week. You can also make it non-repeating event.

Once you are done, click on the ‘Add Cron Event’ button to save your changes.

You will notice that your cron event will now appear in the events list.

However, currently it does nothing because you haven’t told WordPress what to do when this event is triggered.

You will need to add your hook and a 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');
}

Don’t forget to use your own email address.

This function simply sends a test email to you when the cron runs. You can now scroll up the page and click on the ‘Run Now’ link next to your cron event to test it out.

Note: Using cron requires intermediate level programming and WordPress development skills. If you don’t have these skills, we recommend hiring a WordPress developer.

That’s all we hope this article helped you learn how to view and control WordPress cron jobs. You may also want to see our ultimate guide to speed up WordPress and boost performance or our expert picks of the best WordPress security plugins.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

20 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Paul Barrett says

    We run cron at server level because wp-cron overloads teh server. There’s is nothing on our site that is so time-critical the jobs need to running frequently. If we set the frequency to say daily, would WordPress have a problem?

    • WPBeginner Support says

      It would heavily depend on what is being done on the site and when. We do not have a specific recommendation for what can be delayed to that extent.

      Admin

  3. Matt K says

    When I go to change the the recurrence on the Hooks, they just get changed back. Something isn’t right. Do I need to disable WP crons in wp-config.php first?

    • WPBeginner Support says

      It would depend on the specific chron job, if you reach out to the plugin’s support they should be able to assist

      Admin

  4. Heinz says

    Can I deactivate or even delete WP Control plugin in after having set a cron job, so I don’t have too many plugins running and slow down the website?

  5. Andre Hesdahl says

    I am a newbee with WordPress and don’t know where to put (or how to execute) the code:
    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’);
    }

  6. Jeff says

    Thanks for the article. Interesting to see the number of plugins that have cron jobs running often. Great peak under the hood plugin…

  7. hazel beaver says

    When I check the cron schedule the dates shown in the ‘next run’ column are all in the past. Does that mean they are not running?

    In the past I think I added ‘true’ in the wp config file to stop automatic wp updates from breaking my site…. could this be the cause?

  8. Oleg says

    Great article, but no need for

    if ( ! wp_next_scheduled( ‘wpb_custom_cron’ ) ) {
    wp_schedule_event( time(), ‘hourly’, ‘my_task_hook’ );
    }

    this part is done in the plugin,

  9. Ahmad Sayeed says

    I tested you given example. It works like a superman. But please give us an example to send parameter. I have added the function while creating the even. But I don’t know how to use them on PHP function.

    Please give us an example

  10. Sunny says

    My website is coming up with a long wp cron string after my URL and I cant get rid of it. Any thoughts?

    ?doing_wp_cron=1499261576.8675799369812011718750 comes up after my url and its making me look really spammy. Your insight would be appreciated.

  11. Aniket Ashtikar says

    Is that ‘my_task_hook’ cron hook rightly mentioned there at line 2 or should that rather be changed to ‘wpb_custom_cron’?

  12. Matt says

    Do you know if its possible to visit a link in the wp-admin area? I have a plugin that adds admin features to my wordpress site but I really want this scheduled to happen every 24 hours. I have the link but obviously am required to be logged in.

  13. Pam M says

    Do you need that first if statement shown in the sample code? It looks like it would override the ability to schedule and unschedule in the WP Crontrol plugin.
    Your example worked nicely when I scheduled the job in the plugin and tested it with the Run Now option. I’ll see if I get an email at the scheduled time too.
    Thanks for the helpful background info.

  14. Nigam says

    Hi

    When I am going to refresh the page of WP-Cron Events from wordpress admin then only run the event.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.