duanchazhou6779 2015-03-13 17:44
浏览 48
已采纳

PHP Wordpress,何时放置运行时的代码

I followed this guide on how to disable the standard Wordpress method of running cron jobs and running it at an interval, but I do not know where to put the code for what I want to be ran when cron jobs runs. Right now the code I want to run is in functions.php and I do not think it is being called at the interval that cron job is set for. I am 100% sure that cron job is set up right, too, for every 15 minutes.

To rephrase, I have cron jobs running wp-cron.php every 15 minutes instead of the standard 'vrtiaul cron' method Wordpress uses. Putting code in wp-cron.php doesn't seem to work and I want to run some code when cron job runs. Where do I put the code?

  • 写回答

1条回答

  • douzhao2047 2015-03-13 20:08
    关注

    I figured out a work around. Hopefully it will help any newbies in the future that find themselves in a similar situation. Since I couldn't figure out how to make an event and deal with all of that jazz, I just made a cron job to visit the site which calls the standard elements, so I just put my custom code in functions.php. This is the cron job code

    wget -q -O - http://yoursite.com >/dev/null 2>&1
    

    Feels like I am missing a lot of knowledge and it might give me slightly wrong information for Google Analytics in the future, but it works and requires no coding.

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

报告相同问题?

悬赏问题

  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建