Skip to content

Commit e959cc5

Browse files
author
Jonathan Visser
committed
Change wp-cron to a PHP CLI command instead of curling (which gets blocked by our security rules)
1 parent 99cb9e4 commit e959cc5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/ecommerce-applications/woocommerce/how-to-set-up-a-cron-job-for-wordpress-woocommerce-on-hypernode.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In this guide, we'll explain how to replace the default WordPress cron job with
1515

1616
To begin, disable the default WordPress cron by editing the wp-config.php file.
1717

18-
Connect to your server using an FTP client like FileZilla or an SSH client such as PuTTY. Navigate to the root directory of your WordPress installation and locate the `wp-config.php` file. Open the file for editing and add the following line of code before `/* Thats all. Stop editing! Happy blogging. */`:
18+
Connect to your server using an FTP client like FileZilla or an SSH client such as PuTTY. Navigate to the root directory of your WordPress installation and locate the `wp-config.php` file. Open the file for editing and add the following line of code before `/* That's all. Stop editing! Happy blogging. */`:
1919

2020
```php
2121
define('DISABLE_WP_CRON', true);
@@ -34,15 +34,15 @@ app@abcdef-example-magweb-cmbl ~ $ crontab -e
3434
Add the following line to your crontab file to set up a cron job that runs every minute:
3535

3636
```console
37-
* * * * * /usr/bin/chronic wget -q -O - 'https://yourdomain.hypernode.io/wp-cron.php?doing_wp_cron'
37+
* * * * * /usr/bin/chronic php /data/web/public/wp-cron.php > /dev/null 2>&1
3838
```
3939

40-
Replace `https://yourdomain.hypernode.io` with the actual URL of your WordPress site.
40+
**Note:** Make sure to replace `/data/web/public/wp-cron.php` with the actual path to your WordPress installation if it's different from the default path. The default WordPress installation path on Hypernode is typically `/data/web/public/`.
4141

42-
Explanation of the Cron Job Command
42+
### Explanation of the Cron Job Command
4343

4444
- `* * * * *`: Specifies the interval for the cron job. In this case, it is set to run every minute. You can adjust this based on your needs.
45-
- `wget -q -O - 'https://yourdomain.hypernode.io/wp-cron.php?doing_wp_cron'`: Uses wget to make a web request to the WordPress cron URL, triggering any scheduled tasks.
46-
- `>/dev/null 2>&1`: Discards any output from the command, preventing it from filling up your server logs.
45+
- `php /data/web/public/wp-cron.php`: Directly executes the WordPress cron script using PHP, eliminating the need for an HTTP request.
46+
- `> /dev/null 2>&1`: Discards any output from the command, preventing it from filling up your server logs.
4747

4848
After setting up your cron job, monitor your WordPress site to ensure that scheduled tasks are being executed as expected. This setup ensures that your WordPress or WooCommerce site on Hypernode handles scheduled tasks more reliably, especially under conditions where the default cron system may not suffice.

0 commit comments

Comments
 (0)