{"id":44424,"date":"2022-01-31T14:22:42","date_gmt":"2022-01-31T14:22:42","guid":{"rendered":"\/tutorials\/?p=44424"},"modified":"2026-03-10T09:29:19","modified_gmt":"2026-03-10T09:29:19","slug":"how-to-setup-and-manage-a-wordpress-cron-job","status":"publish","type":"post","link":"\/ca\/tutorials\/how-to-setup-and-manage-a-wordpress-cron-job\/","title":{"rendered":"How to set up and manage a WordPress cron job"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Cron is a UNIX utility that allows users to run scheduled tasks on a web server. WordPress has its own cron system called WP-Cron that simulates the UNIX cron system to automate update checkups, scheduled post publishing, and other repetitive tasks.<\/p><p>If you&rsquo;re a WordPress user, knowing how to schedule WP cron events will make your administrative tasks easier.<\/p><p>This article will cover setting up and managing the WordPress cron system with a plugin and WP-CLI. You will also learn the advantages and disadvantages of using WordPress cron and how it differs from UNIX&rsquo;s cron job.<\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Mega-WordPress-Cheat-EN.pdf\" target=\"_blank\" rel=\"noopener\">Download all-in-one WordPress cheat sheet<\/a><\/p><p>\n<div class=\"protip\"><div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                   What Is a WordPress Cron Job?\n                <\/p>\n            <\/div>\n            <p class=\"protip__content\">WordPress cron job is a system that simulates the UNIX cron system to automate task scheduling at custom time intervals. It allows WordPress users to perform time-based tasks on page load, such as publishing schedule posts and checking for updates.<\/p><\/div>\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-are-the-benefits-and-negatives-of-using-wordpress-cron\">What Are the Benefits and Negatives of Using WordPress Cron<\/h2><p>The WP-Cron system is <strong>easy to set up<\/strong> because, unlike the UNIX cron job, it doesn&rsquo;t require knowledge of UNIX commands. Various WordPress cron job plugins come with features that simplify the setup and management process, making the system accessible even for beginners.<\/p><p>By allowing you to schedule repetitive tasks at a custom time interval, you can save time and focus on other essential tasks. Additionally, this system ensures you don&rsquo;t lose any data if the scheduled tasks fail to run on time &mdash; a feat that the UNIX cron job cannot do.<\/p><p>Unfortunately, WP-Cron only runs when a user visits your website. Low-traffic WordPress sites will skip some jobs if no one triggers a page load, causing a <strong>pending cache buildup<\/strong> and harming the site&rsquo;s load time and performance.<\/p><p><a href=\"\/ca\/tutorials\/drive-traffic-to-your-website\/\">Driving traffic to your site<\/a> won&rsquo;t solve this issue. In fact, high-traffic sites that use cron jobs are prone to <strong>race conditions<\/strong> and <strong>long-running processes<\/strong>. Race conditions happen when multiple visits occur at the same time, triggering WP-Cron to execute the same task simultaneously. This builds up a queue of jobs, resulting in slow performance.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-manage-wordpress-cron-jobs-with-a-plugin\">How to Manage WordPress Cron Jobs With a Plugin<\/h2><p>The easiest way to set up and manage WordPress cron jobs involves using a cron job plugin. In this tutorial, we will use <a href=\"https:\/\/wordpress.org\/plugins\/wp-crontrol\/\" target=\"_blank\" rel=\"noreferrer noopener\">WP Crontrol<\/a> as it&rsquo;s free and has all the necessary features. Feel free to use other plugins that suit your preferences.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-install-the-wp-crontrol-plugin\">1. Install the WP Crontrol Plugin<\/h3><p>First, <a href=\"\/ca\/tutorials\/wordpress\/how-to-install-wordpress-plugins\/\">install and activate the WordPress plugin<\/a> for managing cron jobs by following these steps:<\/p><ol class=\"wp-block-list\">\n<li>Navigate to <strong>Plugins &rarr;<\/strong> <strong>Add New<\/strong> from your WordPress admin dashboard.<\/li>\n\n\n\n<li>Use the filter feature to find <strong>WP Crontrol<\/strong> and click <strong>Install Now<\/strong>.<\/li>\n\n\n\n<li>Once the installation is complete, select <strong>Activate<\/strong>.<\/li>\n<\/ol><p>To see all the cron jobs that are running on your WordPress site, go to <strong>Tools &rarr;<\/strong> <strong>Cron Events<\/strong> from your dashboard.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/wpadmin-tools-cronevents.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"555\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/wpadmin-tools-cronevents.png\/w=1024,h=1024,fit=scale-down\" alt=\"The list of existing cron events that currently run on WordPress\" class=\"wp-image-81534\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p><div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                <strong>Important!<\/strong> Don&rsquo;t delete any default WordPress cron jobs (they have the <strong>wp<\/strong> prefix). Doing so will disrupt the site&rsquo;s core functionality.\n            <\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-2-add-a-new-cron-event\">2. Add a New Cron Event<\/h3><p>Now that you can control WordPress cron jobs, you can start managing them. Here&rsquo;s how to add a new cron event:<\/p><ol class=\"wp-block-list\">\n<li>Access the <strong>Cron Events<\/strong> sub-menu and click <strong>Add New<\/strong> at the top of the page.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/wpadmin-tools-cronevents-addnew-highlighted.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"357\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/wpadmin-tools-cronevents-addnew-highlighted.png\/w=1024,h=1024,fit=scale-down\" alt=\"The Add New button can be found at the top of Cron Event's tab\" class=\"wp-image-81538\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol start=\"2\" class=\"wp-block-list\">\n<li>Choose the <strong>Standard cron event<\/strong> option and create a <a href=\"\/ca\/tutorials\/what-are-wordpress-hooks\/\">WordPress hook<\/a> for the new cron event. Make sure the hook name follows the standard PHP naming convention. Schedule the run time and the recurrence. Feel free to leave the <strong>Arguments <\/strong>textbox empty.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/ca\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/01\/add-cron-event.png\"><img loading=\"lazy\" decoding=\"async\" width=\"878\" height=\"564\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/01\/add-cron-event.png\/public\" alt=\"The fields the user needs to fill to create a new cron event\" class=\"wp-image-44437\"  sizes=\"auto, (max-width: 878px) 100vw, 878px\" \/><\/a><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Click <strong>Add Event<\/strong>. The new cron event will appear in the <strong>Cron Events <\/strong>list if the process was successful.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/wpadmin-tools-cronevents-customcron.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"352\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/wpadmin-tools-cronevents-customcron.png\/w=1024,h=1024,fit=scale-down\" alt=\"The new cron event has appeared in the Cron Events list\" class=\"wp-image-81539\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Now that you have a hook, the next step is to add it along with the action that runs when the cron event is triggered. Access your <a href=\"\/support\/1583483-comprehensive-guide-to-hpanel-at-hostinger\/\">hPanel<\/a> dashboard and open <strong>File Manager<\/strong> under the <strong>Files <\/strong>section.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-filemanager-sidebar.png\"><img loading=\"lazy\" decoding=\"async\" width=\"448\" height=\"522\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-filemanager-sidebar.png\/public\" alt=\"The File Manager button on hPanel\" class=\"wp-image-80353\"  sizes=\"auto, (max-width: 448px) 100vw, 448px\" \/><\/a><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Locate your theme&rsquo;s <strong>functions.php<\/strong> file inside the root directory. Double-click the file to open it and add the following code snippet:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">add_action( 'hostinger_custom_cron', 'hostinger_custom_cron_func' );\nfunction hostinger_custom_cron_func() {\n  wp_mail( 'you@example.com', 'Automatic email', 'Automatic scheduled email from WordPress to test cron');\n}<\/pre><p>This example uses the <strong>wp_mail()<\/strong> function which prompts WordPress to send an email when the cron event runs. Don&rsquo;t forget to change the placeholder with an actual email address.<\/p><ol start=\"6\" class=\"wp-block-list\">\n<li>Save the changes made and load your website. If you receive the test email, the cron event is operating correctly.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/ca\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/01\/automatic-email.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1044\" height=\"314\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/01\/automatic-email.png\/w=1024,h=1024,fit=scale-down\" alt=\"The test email that WordPress sent when the new cron event was triggered\" class=\"wp-image-44439\"  sizes=\"auto, (max-width: 1044px) 100vw, 1044px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-3-set-cron-scheduling\">3. Set Cron Scheduling<\/h3><p>The plugin provides four standard time intervals to choose from, but it still allows users to create custom intervals. Follow these steps to add a new cron schedule:<\/p><ol class=\"wp-block-list\">\n<li>Navigate to <strong>Settings &rarr;<\/strong> <strong>Cron Schedules<\/strong> from your WordPress dashboard.<\/li>\n\n\n\n<li>Fill in the fields under the <strong>Add Cron Schedule<\/strong> section. Here, we will set the interval to 600 seconds (10 minutes). Use the PHP naming convention to create the interval name.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/ca\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/01\/cron-schedules.png\"><img loading=\"lazy\" decoding=\"async\" width=\"423\" height=\"397\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/01\/cron-schedules.png\/public\" alt=\"Cron schedules for setting up a new event using seconds as the interval\" class=\"wp-image-44440\"  sizes=\"auto, (max-width: 423px) 100vw, 423px\" \/><\/a><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Click <strong>Add Cron Schedule<\/strong>. The new time interval should appear in the list.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/ca\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/01\/add-cron-schedule.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1202\" height=\"503\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/01\/add-cron-schedule.png\/w=1024,h=1024,fit=scale-down\" alt=\"The Cron Schedules list contains all the available time intervals\" class=\"wp-image-44442\"  sizes=\"auto, (max-width: 1202px) 100vw, 1202px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-4-edit-an-existing-cron-event\">4. Edit an Existing Cron Event<\/h3><p>Now that we have a custom interval, let&rsquo;s use it with the custom cron. Here&rsquo;s how to modify an existing cron event:<\/p><ol class=\"wp-block-list\">\n<li>Go back to <strong>Tools <\/strong>&rarr; <strong>Cron Events<\/strong> and locate the cron event we created earlier. Click <strong>Edit <\/strong>below it.<\/li>\n\n\n\n<li>Open the <strong>Recurrence<\/strong> dropdown menu and pick <strong>10 minutes<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/ca\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/01\/edit-cron-event.png\"><img loading=\"lazy\" decoding=\"async\" width=\"891\" height=\"603\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/01\/edit-cron-event.png\/public\" alt=\"Edit Cron Event page, changing the recurrence of an existing cron event\" class=\"wp-image-44443\"  sizes=\"auto, (max-width: 891px) 100vw, 891px\" \/><\/a><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Click <strong>Update Event<\/strong>.<\/li>\n<\/ol><h2 class=\"wp-block-heading\" id=\"h-how-to-set-up-wordpress-cron-jobs-with-wp-cli\">How to Set Up WordPress Cron Jobs with WP-CLI<\/h2><p>Another way to set up WordPress cron jobs involves using <a href=\"\/ca\/tutorials\/wp-cli\/\">WP-CLI<\/a>. This tool lets you manage the site via a command-line interface.<\/p><p>Hostinger&rsquo;s <a href=\"\/ca\/wordpress-hosting\">Managed WordPress Hosting plans<\/a> come with WP-CLI pre-installed. Therefore, you&rsquo;ll only need to connect to your hosting account <a href=\"\/ca\/tutorials\/how-to-use-putty-ssh\/\">using Putty SSH<\/a>.<\/p><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-wordpress-hosting\" href=\"\/ca\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"600\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-111781\"  sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><p>To access the existing cron events, enter this command in the terminal:<\/p><pre class=\"wp-block-preformatted\">wp cron event list<\/pre><p>The following command will display the other commands you can use with WP-CLI:<\/p><pre class=\"wp-block-preformatted\">wp help<\/pre><h2 class=\"wp-block-heading\" id=\"h-how-to-create-a-real-cron-job\">How to Create a Real Cron Job<\/h2><p>WordPress creates and stores the WP-Cron script inside the <strong>wp-cron.php<\/strong> file. While it allows your WordPress website to have cron jobs running regardless of the OS, this file isn&rsquo;t immune to attacks and may conflict with caching plugins. The use of real <a href=\"\/ca\/tutorials\/cron-job\/\">cron jobs<\/a> can eliminate the constant file execution.<\/p><p>Before setting up real cron jobs, you&rsquo;ll need to disable the default WordPress cron. To disable WP_CRON, add this code snippet to the <a href=\"\/ca\/tutorials\/wp-config-php\/\">wp-config.php<\/a> file above the &ldquo;<em>\/* That&rsquo;s all, stop editing! Happy blogging. *\/<\/em>&rdquo; line:<\/p><pre class=\"wp-block-preformatted\">define( 'DISABLE_WP_CRON', true );<\/pre><p>The next step is to set up a real cron job to schedule WordPress core tasks. The process may vary depending on your hosting provider or service. If you&rsquo;re a Hostinger user, follow this tutorial:<\/p><ol class=\"wp-block-list\">\n<li>Access your hPanel dashboard and navigate to <strong>Cron Jobs<\/strong> under the <strong>Advanced <\/strong>section.<\/li>\n\n\n\n<li>Add this code snippet to the <strong>Command to run<\/strong> textbox:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">wget -O \/dev\/null -o \/dev\/null https:\/\/yoursite.com\/wp-cron.php?doing_wp_cron<\/pre><p>Don&rsquo;t forget to change the placeholder with your website&rsquo;s actual URL.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/10\/cronjob.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1654\" height=\"864\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/10\/cronjob.png\/w=1024,h=1024,fit=scale-down\" alt=\"Cron Jobs section on hPanel \" class=\"wp-image-65596\"  sizes=\"auto, (max-width: 1654px) 100vw, 1654px\" \/><\/a><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>hPanel provides the most common interval options to choose from. We recommend starting with <strong>twice an hour<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Save <\/strong>to store the new cron job settings.<\/li>\n<\/ol><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>The WordPress cron job makes it convenient to schedule tasks at custom time intervals. While WP-Cron has some disadvantages, knowing how to use this utility will allow you to perform administrative tasks more efficiently.<\/p><p>We hope this article has helped you understand the functionality of the WordPress cron job and how to set it up using a plugin and WP-CLI. Good luck.<\/p><p>If you&rsquo;re looking to optimize your WordPress site&rsquo;s performance even further, we recommend using high-quality WordPress hosting.    <\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Learn Other Expert WordPress Techniques                <\/p>\n            <\/div>\n            <p class=\"protip__content\"><a href=\"\/ca\/tutorials\/how-to-create-custom-widget-in-wordpress\/\">How to Create WordPress Custom Widgets<\/a><br>\n<a href=\"\/ca\/tutorials\/how-to-become-wordpress-developer\/\">How to Become a WordPress Developer<\/a><br>\n<a href=\"\/ca\/tutorials\/wordpress-page-template\/\">Guide to WordPress Page Template<\/a><br>\n<a href=\"\/ca\/tutorials\/wordpress-custom-post-types\/\">How to Create a WordPress Custom Post Type<\/a><br>\n<a href=\"\/ca\/tutorials\/wordpress-template-hierarchy\/\">WordPress Template Hierarchy Guide<\/a><\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-set-up-a-wordpress-cron-job-faq\">How to Set Up a WordPress Cron Job FAQ<\/h2><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1643636029505\"><h3 class=\"schema-faq-question\">What Is the Difference Between WP-Cron and Cron?<\/h3> <p class=\"schema-faq-answer\">WP-Cron is a web-based system that simulates the UNIX cron system. WP-Cron events are triggered on page load whereas the real cron runs every minute.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1643636051716\"><h3 class=\"schema-faq-question\">Should I Use the Real Cron or WP-Cron?<\/h3> <p class=\"schema-faq-answer\">WP-Cron works perfectly for its purpose, which is to run WordPress core tasks. However, using it for executing additional tasks can harm your site&rsquo;s load speed. For this reason, we recommend using real cron jobs for better performance.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1643636075938\"><h3 class=\"schema-faq-question\">How Do I Stop a Cron Job in WordPress?<\/h3> <p class=\"schema-faq-answer\">If you have unused cron jobs, the easiest solution would be to delete them. Alternatively, modify the time interval as needed.<br><br>Run this command to delete cron jobs that use a specific hook. This method is ideal for removing obsolete cron jobs.<br><br><code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">$ wp cron event delete hook_name<\/code><\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1677598552714\"><h3 class=\"schema-faq-question\">Where Can I Find Cron Jobs in WordPress?<\/h3> <p class=\"schema-faq-answer\">Cron jobs in WordPress can be found in the <strong>wp-config.php<\/strong> file or by using a plugin such as <strong>WP Crontrol<\/strong> or <strong>Advanced Cron Manager<\/strong>.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1677598597513\"><h3 class=\"schema-faq-question\">How Do I Run a Cron Job in WordPress?<\/h3> <p class=\"schema-faq-answer\">To run a cron job in WordPress, you can use the <strong>wp_schedule_event() <\/strong>function in your theme&rsquo;s <strong>functions.php<\/strong> file or use a plugin such as <strong>WP Crontrol <\/strong>or <strong>Advanced Cron Manager<\/strong> to set up and manage cron jobs.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Cron is a UNIX utility that allows users to run scheduled tasks on a web server. WordPress has its own cron system called WP-Cron that simulates the UNIX cron system to automate update checkups, scheduled post publishing, and other repetitive tasks. If you&rsquo;re a WordPress user, knowing how to schedule WP cron events will make [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ca\/tutorials\/how-to-setup-and-manage-a-wordpress-cron-job\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":115,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"3 Confirmed Ways to Set Up a WordPress Cron Job","rank_math_description":"Using a WordPress cron job is an easy way to automate your website tasks \u2013 check out this guide for 3 methods to manage it!","rank_math_focus_keyword":"wordpress cron job","footnotes":""},"categories":[22692],"tags":[],"class_list":["post-44424","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-setup-and-manage-a-wordpress-cron-job","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/cron-job-wordpress","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/como-configurar-wordpress-cron-job","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-setup-and-manage-a-wordpress-cron-job","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-setup-and-manage-a-wordpress-cron-job","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-setup-and-manage-a-wordpress-cron-job","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/como-configurar-wordpress-cron-job","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/como-configurar-wordpress-cron-job","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/como-configurar-wordpress-cron-job","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/cron-job-wordpress","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-setup-and-manage-a-wordpress-cron-job","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-setup-and-manage-a-wordpress-cron-job","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-setup-and-manage-a-wordpress-cron-job","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-setup-and-manage-a-wordpress-cron-job","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/44424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/comments?post=44424"}],"version-history":[{"count":47,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/44424\/revisions"}],"predecessor-version":[{"id":141524,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/44424\/revisions\/141524"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media?parent=44424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/categories?post=44424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/tags?post=44424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}