nativeInstallerwordpress

Disable the WordPress cron script

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

NOTE: The Approach A sections referred to below do not apply to Bitnami native installers. Users of Bitnami native installers should refer only to the Approach B sections.

The wp-cron.php script will run once a user visits your site. If you get a lot of traffic, this could be a problem. This cron task is really necessary when you make updates in the blog. You can move this cron script to a system cron task to help lower resource usage on the server.

Approach A: Bitnami installations using system packages

Disable the wp-cron.php script in the installdir/wordpress/wp-config.php file. The location is important - add the line below just before the database settings:

define('DISABLE_WP_CRON', true);

Then, add the cron task to the system. For example, this cron task will run the wp-cron.php process every hour. You can add it using the following command:

$ sudo crontab -e
0 * * * * su daemon -s /bin/sh -c "cd installdir/wordpress; installdir/php/bin/php -q wp-cron.php"

Approach B: Self-contained Bitnami installations

Disable the wp-cron.php script in the installdir/apps/wordpress/htdocs/wp-config.php file. The location is important - add the line below just before the database settings:

define('DISABLE_WP_CRON', true);

Then, add the cron task to the system. For example, this cron task will run the wp-cron.php process every hour. You can add it using the following command:

$ sudo crontab -e
0 * * * * su daemon -s /bin/sh -c "cd installdir/apps/wordpress/htdocs/; installdir/php/bin/php -q wp-cron.php"
Last modification September 7, 2021