admin管理员组

文章数量:1122846

Just wanted to ask how can we check which hook is being used for post updates or pages updates, as listing from wp cron event list, there are multiple crons but is there a wayu to recognize post and page update crons and also what are the next run relative and recurrence, I did check the doc but not entirely able to understand them, yes they are showing they are running but a proper understanding would be beneficial

Thank you

Just wanted to ask how can we check which hook is being used for post updates or pages updates, as listing from wp cron event list, there are multiple crons but is there a wayu to recognize post and page update crons and also what are the next run relative and recurrence, I did check the doc but not entirely able to understand them, yes they are showing they are running but a proper understanding would be beneficial

Thank you

Share Improve this question edited Apr 2, 2024 at 12:34 Hamza Mohammad Khan asked Apr 2, 2024 at 12:31 Hamza Mohammad KhanHamza Mohammad Khan 134 bronze badges 6
  • can you be more specific than "post and page update crons"? WordPress cron jobs trigger an action, they don't know what that action does or what's hooked into it, that's up to you, the most information cron on its own can give is the name of the cron job, aka the action/hook it fires. What's the reason you're asking this question? What kind of post/page updates? Which docs did you check? – Tom J Nowell Commented Apr 2, 2024 at 12:49
  • Thanks for the reply tom, basically facing an issue of article updates, a lot of times it is taking 15 to 10 minutes to update so thought of 2 conditions 1 is cron other is CPU , the CPU is fine so thought that the crons might not be triggering at when publishing a post even though they are set every minute, and the lastly was confused like as you can see there are wordfence hooks etc so is there any hook that is of post ? Thank you – Hamza Mohammad Khan Commented Apr 2, 2024 at 13:34
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Bot Commented Apr 2, 2024 at 13:58
  • The thing is we have a customer that is having issues when updating an article it takes around 10 to 15 to show up, check possible solutions, the only thing that I am concerned is the crons that they might not be triggering at the time of publish, apologize the details of the wp-admin I cannot provide – Hamza Mohammad Khan Commented Apr 2, 2024 at 14:06
  • when you create and publish a post in the editor that has nothing to do with cron, the only time cron is involved in WordPress publishing of posts is when you perform a scheduled publish, aka you set a future publish date. If your customer is not using future publishing, and is directly publishing, or updating an already published post, then that has nothing to do with cron and your theory is incorrect – Tom J Nowell Commented Apr 2, 2024 at 14:47
 |  Show 1 more comment

2 Answers 2

Reset to default 0

which hook is being used for post updates or pages updates

WordPress does not use cron jobs to update posts and pages.

The only exception is scheduled publishing of posts and deletion of trash, e.g. if you want to publish a post and set it to publish next wednesday, or when trashed posts are deleted after 30 days.

there are multiple crons but is there a wayu to recognize post and page update crons and also what are the next run relative and recurrence,

A cron job is a way to fire an action/hook in the future at a regular interval. aka do_action but at a future time.

  • hook is the action that will be triggered when the job happens
  • next_run_gmt is the time that action is meant to run ( stored in the GMT timezone ).
  • next_run_relative is WP CLI telling you how long until that time so you don't have to do the math in your head
  • recurrance is how often this happens, e.g. every day? every month?

The thing is we have a customer that is having issues when updating an article it takes around 10 to 15 to show up, check possible solutions, the only thing that I am concerned is the crons that they might not be triggering at the time of publish, apologize the details of the wp-admin I cannot provide –

The chance that this is related in any way to cron is vanishingly small, remote, highly unlikely. It's far more likely to be a caching problem. Unless you have written code that uses cron to publish/update posts, or have used a page builder that uses cron, then this is not something that should be in your top 10 things to debug, and most likely a waste of time.

It's also highly unlikely to be CPU. When PHP handles a request there is a time limit, if your request takes longer than the time limit then a fatal error occurs and a message is logged to the PHP error log. You would see this in the editor either as an error message or a HTTP 500 error. Most servers are pre-configured with timeouts of 20-60 seconds.

I hope I understand your question. Here is a short explanation of the screenshot you sent:

  • Hook -> refers to the name of the cron that is run
  • Next run GMT and next run relative -> the time of the next run
  • Recurrence -> how often should the cron run (hourly, daily, weekly, etc.)

The command line does not give you much information, but if you install the plugin https://wordpress.org/plugins/wp-crontrol/, you will see what specific functions are run when that cron runs. Sadly, you will have to use a code editor to look up the functions in your code or do some research on Google to find out what they do.

Hopefully, this answer will be helpful.

Best wishes!

本文标签: Checking wordpress cron hook for post and updateswhat are the other cron values from wpcli