admin管理员组文章数量:1122832
U have a WordPress multisite install with subfolders. U'm trying to set up cron jobs. I know I can setup for each site with,
HTTP_HOST=sub.example php wp-cron.php > /dev/null
But this doesn't work for subfolders. I also know I can use wget or curl. But is there a way for doing it with php?
Edit: Not a duplicate of suggested question because I clearly mentioned that I have a subfolder install. Answers to that question mostly include wp-cli and some scripts. I don't need that.
Thanks in advance.
U have a WordPress multisite install with subfolders. U'm trying to set up cron jobs. I know I can setup for each site with,
HTTP_HOST=sub.example.com php wp-cron.php > /dev/null
But this doesn't work for subfolders. I also know I can use wget or curl. But is there a way for doing it with php?
Edit: Not a duplicate of suggested question because I clearly mentioned that I have a subfolder install. Answers to that question mostly include wp-cli and some scripts. I don't need that.
Thanks in advance.
Share Improve this question edited Apr 12, 2024 at 5:11 Jesse Nickles 7357 silver badges19 bronze badges asked Jul 16, 2018 at 7:36 Sandakelum KumaraSandakelum Kumara 11 bronze badge 3- 1 Possible duplicate of Running WP Cron on multisite the right way – kero Commented Jul 16, 2018 at 7:45
- I quote I also know I can use wget or curl. But is there a way for doing it with php? – Sandakelum Kumara Commented Jul 16, 2018 at 7:58
- 1 The beste future safe way is to use WP CLI. The second answer in the linked question also includes a PHP only example – kero Commented Jul 16, 2018 at 8:03
1 Answer
Reset to default 0I haven't tested this, but if you don't want to use WP-CLI and ONLY want to use crontab tasks, you would have to add new crontab job for each subsite, like:
curl -s https://example.com/[directory]/wp-cron.php > /dev/null 2>&1
Ref: https://vpsfix.com/7456/setup-proper-cron-jobs-wordpress-multisite-network/
You said your crons are not working for subfolders, but you don't provide any error messages or explain why it's not working... however, it should work, if you follow this.
I don't think you can avoid using wget/curl, unless you write a custom PHP script, you can see this for one example of that:
https://sabrinazeidan.com/fixing-WordPress-multisite-cron/
本文标签: Multisite subdirectory network cron jobs using only crontab and PHP
版权声明:本文标题:Multisite subdirectory network cron jobs using only crontab and PHP? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736292251a1928893.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论