Site icon GetPageSpeed

Mailpoet Cron

Wordpress Cron

Wordpress Cron

Setting up Mailpoet Cron in newer versions (>= 3.11.3)

In the WordPress Admin, head over to MailPoet Settings -> Advanced.

Choose the “Server side cron (Linux cron)”, and copy-paste the command for running cronjob.

php /srv/www/example.com/httpdocs/wp-content/plugins/mailpoet/mailpoet-cron.php /srv/www/example.com/httpdocs/

Make sure to copy-paste the command as provided in your WordPress admin. The above is just an example.

Now, log in to SSH as the Linux user for your WordPress website, run crontab -e command, and paste in the command with the frequency (every minute):

* * * * php /srv/www/example.com/httpdocs/wp-content/plugins/mailpoet/mailpoet-cron.php /srv/www/example.com/httpdocs/

Exit the cron editor and you’re done.

Set up cron for earlier MailPoet versions

The below instructions apply to older versions. At one point, MailPoet developers decided for everyone that the real Linux crons brings more issues than it solves. What?

This is quite outrageous in my opinion. The true performance can be achieved ny using proper server setup and their plugin does something weird. Let’s fix Mailpoet to use Linux cron and not something custom solution they made up out of nowhere.

Disable custom Mailpoet cron

In wp-content/plugins/mailpoet/lib/Config/Initializer.php, disable comment this line:

$this->setupCronTrigger();

So it looks like this:

//$this->setupCronTrigger();

Setup Linux cron for Mailpoet

First, create the actual PHP file which will call Mailpoet cron:

<?php

// Let's load WordPress
require( 'wp-load.php' );

\MailPoet\Cron\Triggers\WordPress::run();

Next, create a Linux cron job which calls it:

* * * * * /usr/bin/php /var/www/html/mailpoet.php

That’s it. Now you can sit back and relax knowing that some crazy custom cron solution is not causing load on your server.

Exit mobile version