{"id":9412,"date":"2020-01-27T13:49:05","date_gmt":"2020-01-27T12:49:05","guid":{"rendered":"https:\/\/www.oderland.se\/support\/artikel\/hur-stanger-jag-av-wp-cron-pa-min-wordpressinstallation\/"},"modified":"2023-05-15T13:49:28","modified_gmt":"2023-05-15T12:49:28","slug":"how-do-i-disable-wp-cron-for-my-wordpress-installation","status":"publish","type":"ht_kb","link":"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-disable-wp-cron-for-my-wordpress-installation\/","title":{"rendered":"How do I disable wp-cron for my WordPress installation?"},"content":{"rendered":"\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">This guide is for advanced users.<\/p>\n\n\n\n<p>Wp-cron is used instead of &#8220;proper cron&#8221; for WordPress installations. The purpose of wp-cron is to handle automations, such as scheduled publication of content, running checks for updates, etc. Wp-cron can, however, cause a problem. The function is called at every page load, so if the site is well-visited, quite large, and\/or complex, it may negatively affect page load speeds drastically.<\/p>\n\n\n\n<p>In this guide, we&#8217;ll show you how you can increase performance on your site by deactivating wp-cron and instead use proper cron (which is run at set times, independent of visits on the site itself).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Edit wp-config.php<\/h2>\n\n\n\n<p>The first step is to disable wp-cron, which is done by adding a line to the settings file for WordPress: <code>wp-config.php<\/code>.<\/p>\n\n\n\n<p>Hence, edit the file wp-config.php associated with your WordPress installation. By default it resides in the document root for the site. You can use the <a rel=\"noreferrer noopener\" aria-label=\"File Manager (\u00f6ppnas i en ny flik)\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-use-the-file-manager-in-cpanel\/\" target=\"_blank\">File Manager<\/a> through cPanel to edit the file, or by using <a rel=\"noreferrer noopener\" aria-label=\"SSH (\u00f6ppnas i en ny flik)\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-connect-to-my-web-hosting-account-using-ssh\/\" target=\"_blank\">SSH<\/a> or FTP. In the latter case, download the file, edit it, and reupload it, overwriting the old file.<\/p>\n\n\n\n<p>Find the line<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/* That's all, stop editing! Happy publishing. *\/<\/pre>\n\n\n\n<p><strong>Above<\/strong> that line, enter the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">define('DISABLE_WP_CRON', true);<\/pre>\n\n\n\n<p>This tells WordPress to disable wp-cron.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create a cron job<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2020\/01\/cpanel_icon_cron_jobs.png\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"311\" src=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2020\/01\/cpanel_icon_cron_jobs.png\" alt=\"\" class=\"wp-image-18735\" srcset=\"https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2020\/01\/cpanel_icon_cron_jobs.png 700w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2020\/01\/cpanel_icon_cron_jobs-300x133.png 300w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2020\/01\/cpanel_icon_cron_jobs-50x22.png 50w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2020\/01\/cpanel_icon_cron_jobs-60x27.png 60w, https:\/\/www.oderland.se\/support\/wp-content\/uploads\/2020\/01\/cpanel_icon_cron_jobs-100x44.png 100w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/figure>\n\n\n\n<p>At this moment, no automatic functions on your WordPress installation will work, so you need to set up a cron job as soon as possible. We have written <a rel=\"noreferrer noopener\" aria-label=\"the following general guide (\u00f6ppnas i en ny flik)\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-create-cron-jobs\/\" target=\"_blank\">the following general guide<\/a> about how to set up cron jobs on web hosting accounts with us.<\/p>\n\n\n\n<p>We recommend that you set the cron job to trigger every five to 15 minutes, and the command you should use is:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wget -O \/dev\/null -o \/dev\/null \"https:\/\/exempel.se\/wp-cron.php?doing_wp_cron\" &gt; \/dev\/null 2&gt;&amp;1<\/pre>\n\n\n\n<p>Swap out <code>https:\/\/exempel.se<\/code> to what is correct for your site&#8217;s domain. (Also correct https to http if you&#8217;re not using https. We always recommend <a rel=\"noreferrer noopener\" aria-label=\"using https (\u00f6ppnas i en ny flik)\" href=\"https:\/\/www.oderland.se\/support\/en\/artikel\/how-do-i-get-started-with-lets-encrypt-ssl\/\" target=\"_blank\">using https<\/a> though.)<\/p>\n\n\n\n<p>Once you&#8217;ve saved the cron job, automations on your site will be managed by cron on the server, instead of wp-cron, which should reduce the site&#8217;s impact on the server &#8211; making the site run faster.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wp-cron is used instead of &#8220;proper cron&#8221; for WordPress installations. The purpose of wp-cron is to handle automations, such as scheduled publication of content, running checks for updates, etc. Wp-cron can, however, cause a problem. The function is called at every page load, so if the site is well-visited, quite&#8230;<\/p>\n","protected":false},"author":12,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"ht-kb-category":[209],"ht-kb-tag":[],"class_list":["post-9412","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-wordpress-websites"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/9412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/comments?post=9412"}],"version-history":[{"count":18,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/9412\/revisions"}],"predecessor-version":[{"id":18737,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb\/9412\/revisions\/18737"}],"wp:attachment":[{"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/media?parent=9412"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb-category?post=9412"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.oderland.se\/support\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=9412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}