Title: pre_clear_scheduled_hook
Published: February 22, 2019
Last modified: May 20, 2026

---

# apply_filters( ‘pre_clear_scheduled_hook’, null|int|false|WP_Error $pre, string $hook, array $args, bool $wp_error )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#wp--skip-link--target)

Filter to override clearing a scheduled hook.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#description)󠁿

Returning a non-null value will short-circuit the normal unscheduling process, causing
the function to return the filtered value instead.

For plugins replacing wp-cron, return the number of events successfully unscheduled(
zero if no events were registered with the hook) or false or a [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
if unscheduling one or more events fails.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#parameters)󠁿

 `$pre`null|int|false|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)

Value to return instead. Default null to continue unscheduling the event.

`$hook`string

Action hook, the execution of which will be unscheduled.

`$args`array

Arguments to pass to the hook’s callback function.

`$wp_error`bool

Whether to return a [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#source)󠁿

    ```php
    $pre = apply_filters( 'pre_clear_scheduled_hook', null, $hook, $args, $wp_error );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/cron.php#L610)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/cron.php#L610-L610)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_clear_scheduled_hook()](https://developer.wordpress.org/reference/functions/wp_clear_scheduled_hook/)`wp-includes/cron.php` |

Unschedules all events attached to the hook with the specified arguments.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/pre_clear_scheduled_hook/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | The `$wp_error` parameter was added, and a [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/) object can now be returned. | 
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fpre_clear_scheduled_hook%2F)
before being able to contribute a note or feedback.