doubiao7410 2019-05-02 07:19
浏览 61
已采纳

Wordpress cron作业只在'用户访问网站'时?

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

  • 写回答

1条回答 默认 最新

  • dqw7121 2019-05-02 07:53
    关注

    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:

    Site Ground Real Cron Job

    Cron Job for WordPress

    If you still find issue please contact me for solving issue.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘