Synology: Speed Up WordPress With Cron

Synology Speed Up WordPress With Cron

One day ago I was telling you how to speed up WordPress with Docker and Cron. Today I’m going to show you how to use Cron for WordPress if you have installed the non Docker version of WordPress like the original WordPress Synology package or the original WordPress downloaded from wordpress.org on your Synology NAS. WordPress is a powerful Content Management System that has its own built-in Cron system known as WP Cron. WP Cron is a task scheduler for WordPress that allows you to schedule various tasks such as publishing scheduled posts, running database maintenance, and sending scheduled emails. However, the integrated WP Cron has a few limitations. One of the major limitations is that it relies on website traffic to run scheduled tasks.

This means that if your website doesn’t receive any traffic, then the scheduled tasks won’t run. In addition, if you have a website that generates high-traffic, the WP Cron integrated in WordPress can cause some performance issues as it can lead to an increase in server load. To overcome these limitations, you can use the server (Synology) side Cron instead of the WP Cron. In this tutorial, I will guide you on how to use the server Cron in WordPress instead of the built-in WP Cron.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install WordPress using my step by step Docker guide. If you already have WordPress installed on your Synology NAS, skip this STEP.

  • STEP 3

Install Text Editor via Synology “Package Center”. (Mandatory STEP.) If you already have Text Editor installed on your Synology NAS, skip this STEP.

Synology Install Text Editor 2023

  • STEP 4

Make sure you have installed Synology Text Editor as per the instructions at STEP 3. Double click on the wp-config.php file in your wordpress folder under the web folder to open it. Follow the instructions in the image below.

Synology Set up WordPress WebStation Cron 1

  • STEP 5

Under the Sets up WordPress vars and included files line, copy and paste this supplementary line. Click X to save the file. Follow the instructions in the image below.

define('DISABLE_WP_CRON', true);

Synology Set up WordPress WebStation Cron 2

  • STEP 6

Go to Control Panel / Task Scheduler / Create / Scheduled Task / User-defined script. Follow the instructions in the image below.

Synology User Defined Script

  • STEP 7

Once you click on User-defined script a new window will open. Follow the instructions below:

    1. General: In the Task field type in “WordPress CRON“. Check the “Enabled” option. Select root User.
    2. Schedule: Select Run on the following days then select “Daily“. Check Continue running within the same day then select Repeat Every 15 minutes.
    3. Task Settings: Type in your own email then Check “Send run details by email” and “Send run details only when the script terminates abnormally“. Copy paste the code below in the Run command area. After that, click OK.
/bin/su -s /bin/sh -c "/usr/local/bin/php82 -f /volume1/web/wp_mariushosting/wp-cron.php" http

Note: Before you paste the code in the Run command area below, remember to change php82 with the php version that you use for your WordPress instance. php80 for PHP 8.0 php74 for PHP 7.4 or php82 for PHP 8.2.
Note: Before you paste the code in the Run command area below, remember to change the wp_mariushosting folder name with your own wordpress folder name.

Synology Set up WordPress WebStation Cron 3

  • STEP 8

After you click OK on STEP 7 a new warning pop up window will open. Click OK.

Synology Set up WordPress WebStation Cron 4

After you click OK, type in your DSM Password then click Submit. Follow the instructions in the image below.

Synology Task Scheduler Confirm Admin Password

  • STEP 9

After you click Submit at STEP 8, select your “WordPress CRON” Task then click the “Run” tab. You will be asked to run WordPress CRON – click OK. Follow the instructions in the image below.

Synology Set up WordPress WebStation Cron 5

Note: That’s it! Using a server Cron job instead of the WP Cron is a great way to ensure that your scheduled tasks run reliably and efficiently, regardless of website traffic. Setting up a server side Cron job is a straightforward process that can help improve the performance and reliability of your website hosted on your Synology NAS device.

This post was updated on Tuesday / August 15th, 2023 at 5:16 PM