Disabling WP-Cron and replacing with a real cron job

By default WordPress is setup to call wp-cron.php everytime someone visits your WordPress website.

On low traffic sites this is perfectly fine, but when visitors roll in, or when under attack 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.

1-Tell WordPress NOT to handle the execution of wp-cron.php with the wp-config.php file.

  1. Open your wp-config.php file with the Plesk Panel File Manager Code Editor.
  2. Go to the bottom of the database settings in wp-config.php typically around line 37.
  3. Add the code below:
    /* The Database Collate type. Don't change this if in doubt. /
    define('DB_COLLATE', '');
    define('DISABLE_WP_CRON', 'true');
  4. Click Save

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

2- Setup manual cron job for wp-cron.php from the Plesk Control Panel

Here you have a choice:

  1. Login to your Parallels Plesk Panel and navigate to your domain
  2. In the Additional Tools section click the Scheduled Tasks icon
  3. Select your username under System User and click Next
  4. Click the Schedule New Task button
  5. Enter the following:
    Minute: /5

    Day of the Month:

    Day of the Week: *
    Command: use either the Curl or Wget command
  6. Click OK

You should now see the following cron:

/5 * wget -q -O – http://yoursite.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Properties ID: 000534   Views: 2239   Updated: 4 years ago
Filed under: