1

publish_post is an action triggered whenever a post is updated and its new status is "publish".

Is there similar action which is trigger when cron is run including WordPress default crons?

I am building a plugin which logged details about every crons. Something like this cron runs at this time, this crons run at this time, etc..... That's why I need this .

2
  • What would you want to do with this that you can't do with your own cron event? Jul 19, 2018 at 4:33
  • 1
    I am building a plugin which logged details about every crons. Something like this cron runs at this time, this crons run at this time, etc..... That's why I need this Jul 19, 2018 at 4:43

1 Answer 1

0

There is such way, I guess...

When you schedule and event with wp_schedule_event all you really do is:

Schedule a hook which will be executed by the WordPress actions core on a specific interval...

And if you'll take a look at wp-cron.php then you'll see, that on line 126 this happens:

do_action_ref_array( $hook, $v['args'] );

OK... So how does it solve the problem?

It does, because you can use all hook. Actions assigned to that hook are called everytime any filter/action is called.

And you can, at least I believe so, use wp_next_scheduled to check, if given hook is event hook or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.