WordPress Scheduler Issues

Newsletter sends out your newsletters at the speed you set on main settings, measured in emails per hour, and splitting the whole job into smaller tasks run by WordPress every 5 minutes.

If WordPress, precisely its internal scheduler, is not able to run the tasks on time, you can experience newsletters stuck into the status “sending (0/nnn)” or not reaching the configured speed.

When the WordPress scheduler is not working correctly, it affects all plugins relying on it and even WordPress itself for the updates check, clean-up tasks, and future post publishing.

What's inside

Check if there are problems

You should take two steps to be aware of problems with the WordPress scheduler:

  1. check the Tools/Site Health panel, it reports if there are tasks not being executed
  2. install WP Crontrol, a plugin that shows the scheduler status and reports which tasks are late

If one or both are reporting issues, read below a few possible solutions.

Activate our cron service

If you’re a customer with an active license, you can activate our cron service which takes care of keeping the WordPress scheduler running on time.

On your account page, select the “cron service” and configure the URL you can find in your blog under the Newsletter plugin main menu System/Scheduler at the voice “Cron URL”.

The URL looks like https://yoursite.com/wp-cron.php.

On System/Scheduler panel, reset the stats or wait some hours to see the effects of this configuration.

Using the provider control panel

Many providers have in their control panels the ability to set up a cron job. A cron job is something that is executed periodically.

The provider can help you in setting up all that, please ask for their support.

The command to be executed every 5 minutes is:

php [path to your blog]/wp-cron.php

The php command could be different, for example, php72 or like. You should ask the provider.

This is the preferred way to trigger the cron since it usually does not suffer from timeout problems.

Alternatively, you can use a different command:

curl https://www.yourdomain.com/wp-cron.php

or

wget --delete-after https://www.yourdomain.com/wp-cron.php

Be sure to use the correct protocol, http:// or https://.

You can load that address in a browser (https://www.yourdomain.com/wp-cron.php) to see if a blank page is returned (it’s ok) or if there are errors reported (the address is not correct, PHP errors, and like).

The commands above are lighter than a web page visit in your blog (when not sending newsletters). Your provider has the resources to deliver 12 page visits in an hour, so there are no reasons to not set up that command.

Using an external cron system

An external service can activate the WordPress scheduler by calling the address below every 5 minutes.

http://www.yourdomain.com/wp-cron.php

There are paid and free services, search on Google for “online cron service”.

Here few services we successfully tried:

Troubleshooting and optimizations

Emails are still delivered slowly

If you set the wanted speed on the Newsletter plugin’s main settings and the WordPress scheduler is working correctly, there are other limits you can look at if the email delivery is slower stan excepted.

CDN can cause problems

If you have a CDN active (for example Cloudflare), the service could cache the calls to wp-cron.php and totally block the WordPress scheduler.

Please, be sure to add an exception for this file in your CDN configuration (or ask the provider to add it for you).

Optimizations

If you set up an external cron trigger with one of the above methods (use only one of them!), you can stop WordPress from trying to auto-trigger the internal scheduler setting on wp-config.php:

define('DISABLE_WP_CRON', true);

That does not disable the scheduler, just disable the WordPress auto-triggering!

The System/Scheduler panel could report a notice about this setting, it’s ok if you set up an alternative scheduler trigger.

The define(...) must be added before the line

/* That's all, stop editing! Happy publishing. */

in your wp-config.php, otherwise, it will be ignored.

WordPress multisite

If you have a multisite installation, the external cron trigger should be set up for each of your blogs and you can use only the wget or curl methods (it’s possible to create more efficient and sophisticated scripts, you should ask a developer).