Products
GG网络技术分享 2025-03-18 16:12 9
I\'ve heard that the wordpress cron job only works when a trigger like \'user visits the website\' occurs. What if I want to run a cron job every night automatically that runs a .php file. The complete scenario is that I want to save some data coming from a third party source as an API call to one of my custom php file, say savedata.php, and I save this data in a text file (for now) and another .php file say: executecron.php is ready to run automatically at 11 pm at night. How can I do this in wordpress without any users visiting my website? And I want to notify that I do not have permission to log into the dashboard but I can work all the php files.
Also please have patience with me as I\'m totally new to wordpress development.
Thanks
图片转代码服务由CSDN问答提供
感谢您的意见,我们尽快改进~
功能建议我听说wordpress cron作业仅在“用户访问网站”等触发器发生时才有效。 如果我想每晚自动运行一个运行.php文件的cron作业怎么办? 完整的场景是我想将来自第三方源的一些数据保存为我的一个自定义php文件的API调用,比如savedata.php,我将这些数据保存在文本文件(现在)和另一个文件中。 php文件说:executecron.php已准备好在晚上11点自动运行。 如果没有任何用户访问我的网站,如何在wordpress中执行此操作? 我想通知我没有登录仪表板的权限,但我可以处理所有的php文件。</ p>
另外请耐心等待我,因为我对wordpress完全不熟悉 开发。</ p>
谢谢</ p>
</ div>
Yes, WordPress Cron Job are only loaded once the user visit the site.
So, as of your problem you want to automatically load the file at certain interval of time you need to configure the cron job from the server and specify the path of the file you want to cron job at fixed interval of time.
The setting mostly found in the cPanel menu but it might vary according to the hosting provider or you can ask hosting provider support team for doing it.
Here are the useful links:
If you still find issue please contact me for solving issue.
Demand feedback