admin管理员组文章数量:1134247
I'm using crontab to run a php script loaded with wp-load.php
with absolute path.
However, when I go to maintenance mode, the file can't run. I'm using Coming soon plugin.
Is there a way to exclude the file and run it even in maintenance mode?
I'm using crontab to run a php script loaded with wp-load.php
with absolute path.
However, when I go to maintenance mode, the file can't run. I'm using Coming soon plugin.
Is there a way to exclude the file and run it even in maintenance mode?
Share Improve this question edited Apr 19, 2019 at 9:49 Fayaz 8,9872 gold badges33 silver badges51 bronze badges asked Apr 19, 2019 at 6:09 Jean R.Jean R. 1112 bronze badges1 Answer
Reset to default 0It's been awhile since the moment of the question, but maybe a solution will help someone in the future.
Just define IS_WP_CLI variable in the beginning of your script .
...
define('IS_WP_CLI', true); // Avoid maintenance mode
require_once HOME_PATH . '/wp-load.php';
...
If IS_WP_CLI defined -> maintenance mode will not be instantiated.
if (defined('IS_WP_CLI')) { return ; }
Now you can run cli scripts even if maintenance mode is active.
本文标签: phpHow to bypass maintenance mode with external cron
版权声明:本文标题:php - How to bypass maintenance mode with external cron? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736802729a1953555.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论