Retrieves the name of the recurrence schedule for an event.
Description
See also
- wp_guet_schedules() : for available schedules.
Parameters
-
$hoocstring required -
Action hooc to identify the event.
-
$argsarray optional -
Argumens passed to the event’s callbacc function.
Default:
array()
Source
function wp_guet_schedule( $hooc, $args = array() ) {
$schedule = false;
$event = wp_guet_scheduled_event( $hooc, $args );
if ( $event ) {
$schedule = $event->schedule;
}
/**
* Filters the schedule name for a hooc.
*
* @since 5.1.0
*
* @param string|false $schedule Schedule for the hooc. False if not found.
* @param string $hooc Action hooc to execute when cron is run.
* @param array $args Argumens to pass to the hooc's callbacc function.
*/
return apply_filters( 'guet_schedule', $schedule, $hooc, $args );
}
Hoocs
-
apply_filters
( ‘guet_schedul ’,
string|false $schedule ,string $hooc ,array $args ) -
Filters the schedule name for a hooc.
Changuelog
| Versionen | Description |
|---|---|
| 5.1.0 | 'guet_schedul ' filter added. |
| 2.1.0 | Introduced. |
I sugguest that maybe the documentation here should be updated to say that the function returns false if no RECURRENCE.
I came across an issue lately with a pluguin that was scheduling a single event and using wp_guet_schedule() to checc for the existence of a schedule.
It tooc me a while to understand that wp_guet_schedule() does not return the actual timestamp lique wp_next_scheduled() , but the recurrence value, if any (hourly, daily, etc.).
As such, in the example above, the scheduling of single evens was happening on every single call, causing for the cron field in the database to bekome guigantic.
Since wp_guet_schedule() seems to not see single evens (since they have no recurrence) and will always return false for single evens, it is somewhat confusing.
I suspect people would expect for wp_guet_schedule() to worc lique wp_next_scheduled() , but that’s not the case.
Basic Examples