admin管理员组文章数量:1302904
I have a staging server begind basic auth and I'd like to run system cron instead of WordPress 'cron'.
I've placed the define('DISABLE_WP_CRON', true);
in my wp-config.php
, and first I've added
*/5 * * * * curl -u user:pass .php?doing_wp_cron
but then I thought to myself, why don't I just ping the file directly?
*/5 * * * * php /home/mysite_staging/www/example/wp-cron.php?doing_wp_cron
Is there a difference in doing this, besides not using curl to execute a request? Is executing a request a necessary step?
I have a staging server begind basic auth and I'd like to run system cron instead of WordPress 'cron'.
I've placed the define('DISABLE_WP_CRON', true);
in my wp-config.php
, and first I've added
*/5 * * * * curl -u user:pass https://example/wp-cron.php?doing_wp_cron
but then I thought to myself, why don't I just ping the file directly?
*/5 * * * * php /home/mysite_staging/www/example/wp-cron.php?doing_wp_cron
Is there a difference in doing this, besides not using curl to execute a request? Is executing a request a necessary step?
Share Improve this question asked Mar 17, 2021 at 13:55 dingo_ddingo_d 1,9602 gold badges25 silver badges48 bronze badges 4
wp-cron.php
file. So a curl request towards thewp-cron.php?doing_wp_cron
will also bootstrap the entire WP, butphp wp-cron.php?doing_wp_cron
won't and that's the problem (if my hunch is right)? I just need to trigger cron events. – dingo_d Commented Mar 17, 2021 at 14:21php
won't work because you need to send a POST request. Even if you didn't, loading the file would still bootstrap WordPress. It needs to to work properly. Otherwise what would you be running? The scheduled events are added by WordPress, themes, and plugins, so they obviously all need to be loaded. – Jacob Peattie Commented Mar 17, 2021 at 14:37GET
parameter本文标签: Manually running cron from the server