Disabling the wp-cron.php in WordPress

WordPress uses a file called wp-cron.php as a virtual cron job, or scheduled task in order to automate things like publishing scheduled posts, checking for plugin or theme updates, sending email notifications and more.

By default WordPress is setup to call wp-cron.php everytime someone visits your WordPress website when a scheduled task is present, to basically ask "is it time to do anything yet?".

On low traffic sites this is perfectly fine, but when visitors roll in, checking multiple times for scheduled tasks can be very inefficient and lead to resource usage problems for your server, plus make your website load slower.

Disable default wp-cron.php behavior

We can easily tell WordPress to let us handle the execution of wp-cron.php with the wp-config.php file.

  1. Open your wp-config.php file with the cPanel File Manager Code Editor
  2. Go to the bottom of the database settings in wp-config.php typically around line 34.
    Add the code below highlighted in red:
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');

    define('DISABLE_WP_CRON', 'true');

  3. Click Save

    Now WordPress will not automatically run the wp-cron.php script each time your site gets a new visitor.

 

  • 4 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

Preventing Wordpress Brute Force Attacks

Since users are no longer using Wordpress as simply a blogging solution, there isn't as much...

Password protect WordPress logins

Using the steps below, I'll show you how to create password protection for your /wp-admin...

Optimizing WordPress with Super Cache plugin

WP Super Cache can help optimize your WordPress website. WP Super Cache will enable your website...

Powered by WHMCompleteSolution