In this guide we are going to show you how to speed up your wordpress page by seperating the cron task execution from your page requests.
Users expect Wordpress to run on many different operating systems, platforms and under various configurations. It is therefor never safe that there is a cronjob service on the server which can handle and schedule tasks. Wordpress has a "very creative" workaround for this problem: EVERY TIME your wordpress page is loaded the wp-cron.php is executed. Wordpress then checks if there are any scheduled tasks that need to be executed.
This Process can lead to significant performance problems of your Wordpress Page. To speed up the user experience for your visitors it is helpful to outsource the cron jobs of your Wordpress page and deactivate the cron task execution on page requests.
1. Deactivate the synchronised execution
In order to deactivate the cron execution on every request, you have to add the following line
wp-config.php file. Make sure to add this line of code after the definition of the
DB_COLLATE constant to avoid problems.
... define('DB_COLLATE', ''); // add after this line define('DISABLE_WP_CRON', true); ...
2. Create a Cron Job in your Looper Account
We can use a simple get call to the
wp-cron.php to run our Wordpress cron jobs.
To do so we create a new Cron Job and configure it like that:
The choice of the Cron Job name is totally up to you. I recommend to choose a name that makes clear what the Cron Job does. This way you can have a great overview of your Cron Job in your Looper Dashboard and in all notification channels.
The method is
GET and the URL is your full domain plus the file
For the frequency you can choose one that fits your needs. Most of the time once or twice a day is totally fine. The example will call the route in a 12 hour interval. The interval is a cron expression. For more informations on cron expressions read about Frequency Documentation in our docs.
The timezone is the timezone your site is running in. For me it is
For the rest of the form we can stick with the defaults. We do not need any extra headers or a payload. If your site is behind a basic auth, you can type the user and the pass in the fields under Authorization.
If your SSL cert is valid you can also leave the default settings here.
After pressing "Create" you can find your newly created Cron Job in the Cron Job Overview. There you can also see the next execution time. If the Cron Job receives an error response from your site you will be notified.
Checkout our Integrations to get your notification via Slack.