Manage Wordpress Cron

How To Edit and Delete WordPress Cron Jobs

Table of Contents

Cron is a Unix/Linux utility that is usually used to schedule background commands or scripts on a web server. A cron job is a task that is used to schedule tasks at regular intervals, such as hours, dates, or intervals. These typically involve time-consuming routine activities that are automated to save time. WP-Cron, which is used to simulate a machine cron in WordPress, takes care of this.

Since WordPress has to run on a variety of devices, operating systems, and configurations, it can't depend on the server's cronjob service to manage scheduled tasks. This is why WordPress developers invented a workaround: when someone loads a tab, the .php file in your main WordPress folder is executed. It then checks to see if there is a scheduled task that needs to be performed and, if so, executes it.

A may be used to schedule the publication of a post or to run a backup plugin on a set schedule. We'll look at how to easily build, alter, and run a WordPress cron job today.

What is WordPress Cron?

WordPress has its own cron framework for tasks like searching for notifications, preparing a post for release, and removing trash comments. WP-Cron is in charge of all cron work.

Although the name (and the main idea) was inspired by UNIX cron, WP-Cron does not function in the same way and instead uses intervals to schedule tasks. Hourly, twice daily, daily, and weekly are the default time intervals given by WordPress. The time-based tasks here are dependent on users visiting your site, so WP-Cron will only run if anyone visits your site.

WP-Cron, in other words, is enabled when the page loads. Many users choose a server-level cron job over the WP-Cron job because this isn't always accurate.

I'll teach you how to handle WordPress cron jobs and set up a real cron job for your WordPress site in this post.

If you need custom WordPress development or management help, do checkout our WordPress services here: Professional WordPress Website Development Services

What is a WordPress Cron Job and How To Manage It?

There are many methods for setting up and handling WordPress cron work, but I'll show you two of the most common ones.

The first employs a cron management plugin such as WP Crontrol, which lets you add, change, and control WordPress cron jobs directly from the WordPress dashboard. You can also set up a cron job, construct hooks and functions, and set custom task time intervals.

The second choice is to use the WordPress CLI.

How to Use a Plugin to Jobs

I'll use the WP Crontrol plugin, which lets you see and access WP cron jobs for your WordPress site. It is the most common plugin for managing WP cron work, with over 100,000 active instals.
This is the best way to handle WordPress cron work, and you can view, edit, build, remove, and do a lot more with WP cron events.

So let's get this party started!

Install the WP Crontrol Plugin first.

You must install and enable WP Crontrol from the plugin repository, just like any other plugin. After it's been mounted, you'll find a new option called “Cron Events” in the Tools tab.

WP-CRON-SETTINGS

Cron Events: How to See and Understand Them

Then click Cron Events to see a list of cron events that are currently active on your WordPress application.

WP-CRON

You can run, edit, and uninstall your cron events from this section. When you hover your mouse over any cron case, you'll see this option.

You'll also find useful information about these cron jobs, such as how to easily classify which cron job is used for which task, and much more. Hook is the name of the hook used by the WordPress core or any plugin in the first column. For example, the prefix “wp” simply indicates that it is a WordPress core cron. You'll also find that there's no way to uninstall these cron events, but you can edit them and run them now. Similarly, you'll find that other prefixes are used by your plugins (for example, “wc” or “woocommerce” for WooCommerce).

Some plugins which are not coded well create cron jobs which might put high load on your server. I had experienced with one of the form plugins which created a cron job to check for updates on hourly basis and that created a lot of load on my server. After looking into the code, I found that it was not well coded. This also led me to compare and write about different types of WordPress Form Plugins.

The arguments passed to the hook functions are mentioned in the second column.

The third column indicates when this cron job will run next.

The fourth column, Action, indicates what action this cron will take (the cron job's “function”).

The cron jobs' recurrence timings are described in the last column. This is essentially the duration of the scheduled mission.

Cron Event Editor

Let's test this plugin by editing a WP cron work.

Click edit next to a hook's name. A new section named “Edit Cron Case” will appear, with various fields. I modified the “wp privacy delete old export files” hook in my case. After that, I'll change the cron job's recurrence to “Every Fifteen Minutes.”

Customizing a Time Interval

EDIT-WP-CRON

After that, I'll demonstrate how to add a custom time interval to your cron events. To do so, press the “Cron Schedule” tab, which will bring up a new screen with the specifics of the planned time intervals. Then scroll down to the bottom and click “Add Cron Schedule.” To create a cron schedule, fill in the fields and press Add Cron Schedule.

ADD-CRON-WORDPRESS

It's worth noting that the interval input is in seconds. To make the interval 10 minutes, I'll use 600 seconds.

You can now edit your cron event and replace the default interval with your own.

EDIT-WORDPRESS-CRON

Adding a New Cron Event 

Now that you know how to handle basic cron jobs, what if you want to build your own cron job for your WordPress application? Don't worry, it's really simple, and all you have to do is follow the steps below.

To start, click Add Cron Event to join the add cron section. Then give the hook whatever name you want (should follow normal PHP naming convention and no spaces).

Then, optionally, add arguments (in my case, it's blank). Then, in the Next Run area, choose any choice and enter a time. Finally, for your new cron, select a recurrence time (schedule time) and press Add Event.

ADD-WP-CRON

If you have any concerns, you can look at the settings of any currently running cron job in your cron events.

Go to the cron events tab after adding a new cron job and check your newly developed cron. You'll note that None appears in the action column (error). This is because no actions have been identified for this cron work. As a consequence, you'll need to add an action and a few lines of code to the theme's functions.php file.

CRON EVENTS

Note: Backing up the WordPress site is strongly recommended before proceeding.

Let's open the file and add the following lines of code after the

add_action( 'rockin_new_cron', 'rwp_function' );
function rwp_function() {
wp_mail( 'tousif@rockinwordpress.com', 'Rockin Cron', 'Rockin WordPress!' );
}

Don't forget to substitute your own email address for mine.

EDIT THEMES WP CRON

As you can see in the picture above, I edited it directly in the WordPress dashboard. You can edit this file using an FTP client like FileZilla if you want to.

Check your email inbox to see if the message was sent. Most probably it will be there.

How to Use WP CLI to Manage WordPress Cron Jobs

You can also use the WordPress CLI to display and control all of your WordPress cron work. You must open the terminal and log in with the server credentials.

The route to your WordPress application should then be entered. The URL in my case was:

cd var/www/public_html/

Next, you need to run this command:

wp cron event list
WP CLI WP CRON

The hook term, next run time, next run relative, and recurrence are all visible (scheduled time).

How to Setup a Cron Job

You now understand what a WordPress cron work is and how it performs. What if you need to replace it with a real cron job for some purpose, such as low traffic, critical tasks that must be completed at a specific time, DDoS attacks, or a long page load time?

So let's get this party started!

Step 1: Edit the wp-config.php file.

To begin, use an FTP client such as FileZilla or an SSH client such as PuTTY to open the wp-config file. Then, before the line that says /* That's it, stop editing!, Have fun with your blogging. */ add the following line of code to the file.

define('DISABLE_WP_CRON', true);

This code disables your WordPress site's running cron events, allowing you to build a real cron job on server.

Step 2: Adding a New Cron Job on Server

To do so, go to cPanel and scroll down using your cPanel credentials. Within the Advanced section, look for the Cron Jobs option and select it.

CRON JOBS WORDPRESS

Scroll down to the Add New Cron Job section in the new window that appears. Select the recurrence time from the Common Settings list and type the following into the Command field:

wget -q -O – https://your-website-url.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Instead of the placeholder https://your-website-url.com, make sure to use the real website URL. When you're done, click Add New Cron Work.

CRON JOBS SERVER

The GNU Wget utility is included in the command we used. We recommend that you check the Wget manual to learn about all of the available commands, as this is a fairly advanced topic that needs further research.

The >/dev/null 2>&1 portion at the end of the command we used can be omitted. You may choose to leave it out because it just serves to disable email alerts for the scheduled Cron work.

Final Words

Being able to automate and plan those website activities can be extremely beneficial. You can be sure that you won't forget to run a regular task or that you won't be late if you use a WordPress Cron work. Furthermore, they will save you time, enabling you to concentrate on improving your website, using SEO tools, or just sitting back and relaxing. We hope that this article has shown that Cron jobs are not a mystery and that they are relatively simple to handle. So you can focus on more difficult tasks while Cron takes care of the minor details.

Share This Article:
Facebook
Twitter
LinkedIn
Pinterest
WhatsApp
Email
Reddit
Related Articles:
image size reduce online
Facebook
Free Image Size Reduction Trick

Without Any Plugin Did you know that a normal website gets most of its weight from the images used in it? It is true. The majority of website size is mostly because of the images used in its pages. Optimizing images without losing quality is a difficult task for average

Read More »
free wordpress hosting
Plugins
Host Your WordPress Website For Free Forever

Hosting a WordPress website can be an expensive thing if not done properly. It can go from just a few dollars to thousands of dollars a month. Finding WordPress hosting can be a difficult task. If you own a small blog or website that you do not update often then

Read More »
free high quality backlinks
Backlinks
Get Free High Quality Backlinks The Creative Way

A backlink in the SEO world is a link from a post or a page on one website to another. If a website is linking to your content, it means you got a backlink. These backlinks are also called “inbound links”. Sometimes they are also called “incoming links”. Carrying a

Read More »
Google Analytics
Adding A New Website To Google Analytics

Google Analytics can be applied to a new website in two ways. The first is to create a brand new Google Analytics account, and the second is to add a new property to an existing account. If you’re like me and add websites to Google Analytics on a regular basis,

Read More »
ecommerce seo guide
eCommerce
Ecommerce SEO Tips And Guide From Google

In a recent update of Google Developer Docs, Google has added new information for best practices for E-commerce in search. This is big news. Because this clearly lays a foundation for documents on SEO for eCommerce websites. Today we will see what are the most important parts of this documentation

Read More »
Subscribe to our newsletter
Chat With Our SEO community members On discord
Discord SEO Community Chat
  • Just-iko avatar Just-iko Thank you very much for answering ☑️ ✨
  • ddev66 avatar ddev66 Put your content in the right HTML tags and Google will show it this way.

    In the picture that you show, the first content is put in a list with bold headings.
    The second content is a FAQ on that page.

    Put in the right HTML tags and Google will pick it up nicely.
  • Just-iko avatar Just-iko Hello, I'm a newbie in this field, any guidance would be appreciated :) some questions please, is there any idea on how to make our website could appears like that in Google search? The one that I marked..
  • ddev66 avatar ddev66 Semrush or Ahrefs will help you for spying competitors.

    I think Semrush has a trial period as well.
  • Aadhi avatar Aadhi Buy semrush, you can buy it at cheap rate by using Group buy method
  • SG.CK avatar SG.CK Any free tool for spy traffic and ranking ?
  • ddev66 avatar ddev66 Search on google “htaccess redirect rules”
    Put them in your website’s htaccess file if you are using Apache
  • BrunoAfonso avatar BrunoAfonso how should I go to solve this issue
  • BrunoAfonso avatar BrunoAfonso Can you explain a little bit more? My website is not wordpress, I use amazon web services
  • ddev66 avatar ddev66 You can make a 301 redirect to the correct page on your website.
    If you are using Wordpress then SEO plugins like rank math have this feature.
    If you don’t want to use SEO plugins then there are many good redirect plugins in the Wordpress repository.
    And if you are not using Wordpress then .htaccess file is your friend.
  • BrunoAfonso avatar BrunoAfonso For example, is this image, the second link "THU Main Event" goes to a different page that it's supposed to. How do I fix this.
  • BrunoAfonso avatar BrunoAfonso So I have a website and when you search for it, one of the hyperlinks that google provides goes to the wrong page, is there a specific way for me to change that?
  • ddev66 avatar ddev66 Need more explanation
  • BrunoAfonso avatar BrunoAfonso Hello people, does anyone know how to fix a hyperlink within a google search?
  • ddev66 avatar ddev66 Semrush shows you all the links that it considers as toxic in its domain overview dashboard. You can then use these website list to disavow in GSC.
  • rrakesharmaa avatar rrakesharmaa I want to remove high spam backlinks via Disavow tool. So i need these links.
  • ddev66 avatar ddev66 extract high spam score backlinks.
    This is little confusing for me to understand

    Do you want to remove high spam backlinks to your website or do you want to receive backlinks from websites that have a high spam score?
  • yaswanth avatar yaswanth Now I use the Search console live URL inspector. It shows the page source and screenshot with an error(If any).
    Result: The page is not mobile friendly in the screenshot. All the element's styles are broken.

    Now, I feel like, " What the hell is happening in rich result tester? The google bot shows everything is ok, and in the search console, this is happening."

    # Problem Digging Stage final stage - Solving the problem
    The easiest way to solve the problem is to compare the thing and find the difference.
    Is rich results tester a google bot? Yes!
    Is it owned by google? Yes!
    Is it have any link with the official search console crawler? No!

    Now, What is the difference between 2 crawlers?
    Their IPs are different. They work differently.

    Summary: Google bot (Offical bot) is not able to crawl all elements in the webpage. It is not able to read all styling files. All other bots(services that use crawl as Google Bot) can view/crawl the page.

    List of official google bot IPs: https://developers.google.com/search/apis/ipranges/googlebot.json

    Solution: Rather than digging into all files, we changed the hosting server located in the exact location.

    Thank you for reading this article. It takes a few mins to read this article, but It took hours to find the correct problem with a solution. If you find this article valuable, give it a like and if you have any questions, feel free to ask them.
  • yaswanth avatar yaswanth Solving Critical Indexing Problem (CASE STUDY)

    Last week I received a message from a friend he is requesting me to help him index a page of his website. I said, " Wait, sometime google will index automatically" Then he said he was getting problem with his homepage. So, I started digging. First, I want to find the problem. Then all other things were easy.

    # Problem Digging Stage 1 - Analyze the top layers
    Checking the basic things
    1) No Index tags
    2) Canonical tags
    3) Website page Age

    Result: Nothing Found

    # Problem Digging Stage 2 - Getting Deeper
    1) Checking status codes (If there is any redirects, 404 error, or soft 404 errors)
    2) Using an SEO browser to check the web page accessibility
    3) Trying with different user agents

    Result: Nothing Found

    # Problem Digging Stage 3 - Analyzing and
    comparing past and current stages of webpage
    1) Checking the Wayback machine for any spam content history
    2) Checking the search console for errors
    3) Other page's indexability

    Result: I got some clue. Search console shows "Page is not mobile friendly."

    # Problem Digging Stage 4 -Finding the reason for the search console error.
    When I checked the web page with SEO Browser, the page was mobile friendly, and I also tried "crawl as Googlebot." Everything looks good. Then where is the problem?

    One thing was confirmed google is not able to view the webpage clearly. And all other bots are not getting any problems.

    So, I decided to use only google properties in the further process (Because only the google bot gets stuck).
    I selected three tools to process further.
    1) Google page speed insights
    2) Google rich results tester
    3) Search console Live URL inspector

    First, I used page speed insights to check If the google bot can crawl/view the page or not(If there are any issues in crawling, then the tool returns a lighthouse error)
    Result: everything is ok

    Second I used Google rich results tester. It provides the page source and screenshot of the webpage.
    Result: everything is ok
  • achann avatar achann Backlink actually link that provided outside web, so if you use instagram and insert your web link that still counted as backlink.
  • achann avatar achann If you want to be free, why not using mailchimp for email blast. Or maybe you can use whatsender for whatsapp blast, there is nulled version I think.
  • achann avatar achann Um.. Maybe you can use whatsapp blast and give link? Or maybe you can use email marketing and give link to your web?
  • rrakesharmaa avatar rrakesharmaa How can I extract high spam score backlinks for my website? Is there any free tool that provides all high spam score sites HELP ME PLEASE 🙂
  • nkap avatar nkap <@211319858258771968> hey, would you be able to share the website that you want guest posts on? I’m in touch with a few fintech businesses and can ask them whether they’d be interested in putting a post on your site.
  • ddev66 avatar ddev66 <@211319858258771968> it sure will work. Make sure to write that it’s free to post as guests. A lot of websites do not mention this and writers usually think it’s paid opportunity only.

    Keep us updated of how well this goes for your website.
  • soutaraku avatar soutaraku Thank you so much for the detailed guide. I'll see if I can put up the Guest Post page to start with! I hope my email gets bombarded in a good way haha
  • ddev66 avatar ddev66 You should start putting up a page called Guest Posting on your other website where you put articles, etc.. and put all the requirements there which you are looking for in the guest posts. Make sure to leave your email as well for easier contacts.

    Build up some links to this page. Because most of the writers are looking to write for high metrics website that have good DA, TF, etc...

    Once you have a page setup it will help you get attention from people who are searching on Google.

    Next you can start sending the URL of this page to people whom you think might be interested to write for your service on social networks like twitter, linkedin, etc.

    Also list this page URL on websites that have posts like free guest posts list in SaaS, free guest posts list in "your niche", etc. Something like this: https://underwp.com/the-best-free-guest-posting-websites-list-in-2022-over-3000/

    These will get you enough traction to attract guest posts from various contributors over the time. Your email will be bombarded with emails following the above tips.
  • soutaraku avatar soutaraku I can translate guest post to Japanese and put it on our website to share stories from overseas. I thought it would be interesting for our readers and a good way for link building.
  • soutaraku avatar soutaraku It's not titled as contribute/guest posts page, but there's a website we put interview articles and such. We surely can put guest posts on that website.
  • ddev66 avatar ddev66 <@211319858258771968> does your website have contribute/guest posts page?
  • soutaraku avatar soutaraku Hi guys! I'm a Japanese SEO specialist/ content editor working for a fintech company, and looking for someone to put guest posts on our website (preferably about fintech or SaaS market). Are there any good place to look for people willing to guest post?

    In Japan, not many people write guest posts, so I'm kinda lost. Twitter trick is only guiding light to me, <@838326478924021760>. Thanks for sharing.
  • Deleted User avatar Deleted User trying it out right now
  • nkap avatar nkap Great idea! Will definitely try it out. Thanks mate.
  • ddev66 avatar ddev66 A good trick to get guest posts for your website. <@456226577798135808> <@755307075625549854>
  • Büşra avatar Büşra Thank you very much. I'll try 😊
  • nkap avatar nkap Yeah me too!!
  • naaz avatar naaz <@755307075625549854> Thank you for the detailed answer. Hope <@341197404302737408> finds the right solution for this.
  • nkap avatar nkap <@341197404302737408> Just these:

    You can try 3 things: (I suggest you try the 3rd option first)

    1. If there are any links in your coverage report that’s actually not from your domain/property, I’d recommend you use the Search Console’s removal tool to remove these from your property.

    2. If you’re using any page builders like elementor etc make sure you turn off search engine indexing for things like templates. You can find this in Yoast SEO settings. With this setting your templates and unnecessary pages won’t be indexed. Are you using elementor by any chance?

    3. It’s also possible that your site has been hacked. If random URLs are appearing in analytics and search console the first thing that you should do is check your .htaccess file to see if someone has put any rewrite rules.
  • ddev66 avatar ddev66 <@755307075625549854> got any views on this?
  • ddev66 avatar ddev66 did you change your permalinks sometime back in last few months?
  • naaz avatar naaz <@838326478924021760> bringing to your attention on this.
  • Büşra avatar Büşra hello guys! I need to help about SEO optimation. I'm using wordpress Yoast. I saw dummy link like as ``` https://myURL.com/cuisine/35/17498``` I haven't these in page. Btw ı'm using google search console. Why may be this? Is anyone has idea about that?
  • ankit662003 avatar ankit662003 does anyone know how to create seo silos?
  • ankit662003 avatar ankit662003 hi
  • ddev66 avatar ddev66 Just know that we are all here to help each other
  • ddev66 avatar ddev66 No worries mate.
  • Alex25 avatar Alex25 The thing is idk what to ask .
    I'm just stuck
  • ddev66 avatar ddev66 Drop your queries here

3 Responses

  1. Good find of Wp Crontrol plugin. Cannot believe such an awesome plugin does not show up in the featured sections of Add new plugins page in WordPress. The plugin author also works with the official WordPress development team. This is a huge plus for me to try this plugin. Already it helped me delete some unnecessary cron jobs that were started with plugins that I do not use now.

  2. Did not knew about the crontrol plugin. I was only checking the wp config file if my developer disabled the cron for my wordpress website.
    Listing of all the cron jobs in one dashboard is the best feature that I liked about this plugin.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: