The customer portal my.neoserv.com has been redesigned. If you notice any issues, please let us know.

Cart (0)
  • Your cart is currently empty.

NEOSERV BLOG

Tips, guides and useful information about domains, hosting, SSL certificates, email, web optimization and online security.

Kako nastaviti Cron opravila za hitrejše delovanje WordPress strani
Category: Websites
Published:

Cron jobs are used to automate the running of scripts on a website. For example, you can use cron to set when backups are made, when the system checks for updates, when a post should be published, etc.

Example:

00 11 * * * * * /home/backups/scripts/log_backup.sh

This command tells the operating system to run a script called“log_backup.sh” every day at 11:00.

If you have a WordPress website, WP-Cron takes care of the cron jobs. Depending on the amount of web traffic, in some cases the use of WP-Cron will affect the loading speed of the website. Check below how to disable WP-Cron and use the server-side cron job instead to improve your site’s performance.

Why is WP-Cron not efficient enough?

WP-Cron checks and executes set tasks on your pages, subpages and posts every time a visitor visits your website.

Zero visitors = zero WP-Cron tasks

WP-Cron needs constant web traffic to work properly. If a site receives no or very few visitors for a certain period of time, the cron jobs cannot be executed, which in some cases leads to a WordPress system error.

More visitors = more unnecessary WP-Cron jobs

If you get 10 page views every second, in this case WP-Cron checks the job 10 times every second. This process requires the execution of PHP operations. This activates server resources and your page may slow down due to increased traffic.

How to disable WP-Cron?

WP-Cron can be easily disabled using the command in the wp-config.php file. On line 1 or before the line “That’s all, stop editing! Happy blogging.” add the following command:

define('DISABLE_WP_CRON', true);

How to disable WP Cron?

After disabling WP-Cron, it is necessary to activate cron jobs at server level.

How to set up a server-side cron job?

The server-side cron job can be configured in different ways. Check below how to do it in the cPanel control panel.

  1. Log in to cPanel.
  2. In the ADVANCED section, click on the Cron Jobs icon.

Cron Jobs in cPanel

  1. In the Add Cron Job field you have the option to set different time intervals for cron jobs. In the example below, we have set the job to run every ten minutes. NOTE: In the case of online stores where the need to execute cron jobs is higher, we advise you to set the execution to 2-3 minutes.
    cPanel - Cron settings
  2. In the Command field, add the following item( replacedomain.com with your domain):
wget -q -O - https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

cPanel - Adding Cron Jobs

  1. Click on the Add New Cron Job button.

If you have completed all the steps, you have successfully deactivated WP-Cron and set up a server cron job.

COMMENTS

COMMENT THE POST

(mandatory)
(mandatory, email address will be hidden)
(optional)
Security question that confirms you are a real person.