pre_get_scheduled_event
Filter HookDescription
Filter to override retrieving a scheduled event. Returning a non-null value will short-circuit the normal process, returning the filtered value instead. Return false if the event does not exist, otherwise an event object should be returned.Hook Information
File Location |
wp-includes/cron.php
View on GitHub
|
Hook Type | Filter |
Line Number | 770 |
Hook Parameters
Type | Name | Description |
---|---|---|
null|false|object
|
$pre
|
Value to return instead. Default null to continue retrieving the event. |
string
|
$hook
|
Action hook of the event. |
array
|
$args
|
Array containing each separate argument to pass to the hook's callback function. Although not passed to a callback, these arguments are used to uniquely identify the event. |
int|null
|
$timestamp
|
Unix timestamp (UTC) of the event. Null to retrieve next scheduled event. |
Usage Examples
Basic Usage
<?php
// Hook into pre_get_scheduled_event
add_filter('pre_get_scheduled_event', 'my_custom_filter', 10, 4);
function my_custom_filter($pre, $hook, $args, $timestamp) {
// Your custom filtering logic here
return $pre;
}
Source Code Context
wp-includes/cron.php:770
- How this hook is used in WordPress core
<?php
765 * @param array $args Array containing each separate argument to pass to the hook's callback function.
766 * Although not passed to a callback, these arguments are used to uniquely identify
767 * the event.
768 * @param int|null $timestamp Unix timestamp (UTC) of the event. Null to retrieve next scheduled event.
769 */
770 $pre = apply_filters( 'pre_get_scheduled_event', null, $hook, $args, $timestamp );
771
772 if ( null !== $pre ) {
773 return $pre;
774 }
775
PHP Documentation
<?php
/**
* Filter to override retrieving a scheduled event.
*
* Returning a non-null value will short-circuit the normal process,
* returning the filtered value instead.
*
* Return false if the event does not exist, otherwise an event object
* should be returned.
*
* @since 5.1.0
*
* @param null|false|object $pre Value to return instead. Default null to continue retrieving the event.
* @param string $hook Action hook of the event.
* @param array $args Array containing each separate argument to pass to the hook's callback function.
* Although not passed to a callback, these arguments are used to uniquely identify
* the event.
* @param int|null $timestamp Unix timestamp (UTC) of the event. Null to retrieve next scheduled event.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/cron.php
Related Hooks
Related hooks will be displayed here in future updates.