WordPress在特定页面上执行特定的cronjob
我有一个小型旅行页面,该页面使用内置的Cron Jobs(WP-Cron)每4小时通过API同步巡回演出和会议,直到这里一切都是完美的。
现在,我现在要实现的目标是,在特定页面上时,我也要“有力”执行此特定的cronjob(无论如何),例如,谢谢您的页面(不是wooCommerce)。
实现这一目标的最佳方法是什么?感谢您的一些专家帮助,谢谢。
I am having a small tour page that uses built-in cron jobs (wp-cron) to sync tours and sessions via an API every 4 hours and until here everything is perfect.
Now, what I am trying to achieve now is to also and "forcefully" execute this specific cronjob (regardless of it's schedule) when being on a specific page, e.g. Thank you page (not Woocommerce).
What's the best way to have this achieved? Some expert help would be greatly appreciated, thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我一直怀疑,您是否使用服务器的本机CRON作业或WordPress的WP-Cron?
I have been left with the doubt, are you using the native Cron job of your server or the wp-cron of WordPress?
我认为您可以使用Admin_Init钩子尝试尝试并检查页面ID或URL,然后运行执行函数。
I think you can try by using admin_init hooks and check the page id or url then run the execute function.