Title: wp_next_scheduled
Published: April 25, 2014
Last modified: May 20, 2026

---

# wp_next_scheduled( string $hook, array $args = array() ): int|false

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#user-contributed-notes)

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

Retrieves the timestamp of the next scheduled event for the given hook.

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

 `$hook`stringrequired

Action hook of the event.

`$args`arrayoptional

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, so they must match those used when originally scheduling the event. If
the arguments do not match exactly, the event will not be found.

Default:`array()`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#return)󠁿

 int|false The Unix timestamp (UTC) of the next time the event will occur. False
if the event doesn’t exist.

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

    ```php
    function wp_next_scheduled( $hook, $args = array() ) {
    	$next_event = wp_get_scheduled_event( $hook, $args );

    	if ( ! $next_event ) {
    		return false;
    	}

    	/**
    	 * Filters the timestamp of the next scheduled event for the given hook.
    	 *
    	 * @since 6.8.0
    	 *
    	 * @param int    $timestamp  Unix timestamp (UTC) for when to next run the event.
    	 * @param object $next_event {
    	 *     An object containing an event's data.
    	 *
    	 *     @type string $hook      Action hook of the event.
    	 *     @type int    $timestamp Unix timestamp (UTC) for when to next run the event.
    	 *     @type string $schedule  How often the event should subsequently recur.
    	 *     @type array  $args      Array containing each separate argument to pass to the hook
    	 *                             callback function.
    	 *     @type int    $interval  Optional. The interval time in seconds for the schedule. Only
    	 *                             present for recurring events.
    	 * }
    	 * @param string $hook       Action hook of the event.
    	 * @param array  $args       Array containing each separate argument to pass to the hook
    	 *                           callback function.
    	 */
    	return apply_filters( 'wp_next_scheduled', $next_event->timestamp, $next_event, $hook, $args );
    }
    ```

[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#L859)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/cron.php#L859-L888)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#hooks)󠁿

 [apply_filters( ‘wp_next_scheduled’, int $timestamp, object $next_event, string $hook, array $args )](https://developer.wordpress.org/reference/hooks/wp_next_scheduled/)

Filters the timestamp of the next scheduled event for the given hook.

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

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

Retrieves a scheduled event.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [WP_Upgrader::schedule_temp_backup_cleanup()](https://developer.wordpress.org/reference/classes/wp_upgrader/schedule_temp_backup_cleanup/)`wp-admin/includes/class-wp-upgrader.php` |

Schedules the cleanup of the temporary backup directory.

  | 
| [wp_schedule_update_user_counts()](https://developer.wordpress.org/reference/functions/wp_schedule_update_user_counts/)`wp-includes/user.php` |

Schedules a recurring recalculation of the total count of users.

  | 
| [wp_get_auto_update_message()](https://developer.wordpress.org/reference/functions/wp_get_auto_update_message/)`wp-admin/includes/update.php` |

Determines the appropriate auto-update message to be displayed.

  | 
| [WP_Site_Health::maybe_create_scheduled_event()](https://developer.wordpress.org/reference/classes/wp_site_health/maybe_create_scheduled_event/)`wp-admin/includes/class-wp-site-health.php` |

Creates a weekly cron event, if one does not already exist.

  | 
| [WP_Recovery_Mode::initialize()](https://developer.wordpress.org/reference/classes/wp_recovery_mode/initialize/)`wp-includes/class-wp-recovery-mode.php` |

Initialize recovery mode for the current request.

  | 
| [wp_schedule_delete_old_privacy_export_files()](https://developer.wordpress.org/reference/functions/wp_schedule_delete_old_privacy_export_files/)`wp-includes/functions.php` |

Schedules a `WP_Cron` job to delete expired export files.

  | 
| [populate_network()](https://developer.wordpress.org/reference/functions/populate_network/)`wp-admin/includes/schema.php` |

Populate network settings.

  | 
| [get_default_post_to_edit()](https://developer.wordpress.org/reference/functions/get_default_post_to_edit/)`wp-admin/includes/post.php` |

Returns default post information to use when populating the “Write Post” form.

  | 
| [wp_schedule_update_checks()](https://developer.wordpress.org/reference/functions/wp_schedule_update_checks/)`wp-includes/update.php` |

Schedules core, theme, and plugin update checks.

  | 
| [wp_version_check()](https://developer.wordpress.org/reference/functions/wp_version_check/)`wp-includes/update.php` |

Checks WordPress version against the newest version.

  | 
| [_publish_post_hook()](https://developer.wordpress.org/reference/functions/_publish_post_hook/)`wp-includes/post.php` |

Hook to schedule pings and enclosures when a post is published.

  | 
| [wp_schedule_update_network_counts()](https://developer.wordpress.org/reference/functions/wp_schedule_update_network_counts/)`wp-includes/ms-functions.php` |

Schedules update of the network-wide counts for the current network.

  |

[Show 7 more](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#)

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

| Version | Description | 
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#comment-content-1598)
 2.    [ub3rst4r](https://profiles.wordpress.org/ub3rst4r/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/wp_next_scheduled/#comment-1598)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_next_scheduled%2F%23comment-1598)
     Vote results for this note: 10[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_next_scheduled%2F%23comment-1598)
 4.  Note the $args parameter! Not specifying the $args parameter in wp_next_scheduled
     but having $args for wp_schedule_event will cause many events to be scheduled (
     instead of just one).
 5.  Bad Example:
 6.      ```php
         if ( ! wp_next_scheduled( 'myevent' ) ) { // This will always be false
         	wp_schedule_event( time(), 'daily', 'myevent', array( false ) );
         }
         ```
     
 7.  Good Example:
 8.      ```php
         $args = array( false );
         if ( ! wp_next_scheduled( 'myevent', $args ) ) {
         	wp_schedule_event( time(), 'daily', 'myevent', $args );
         }
         ```
     
 9.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_next_scheduled%2F%3Freplytocom%3D1598%23feedback-editor-1598)
 10.  [Skip to note 4 content](https://developer.wordpress.org/reference/functions/wp_next_scheduled/?output_format=md#comment-content-2141)
 11.   [Kuba Mikita](https://profiles.wordpress.org/kubitomakita/)  [  9 years ago  ](https://developer.wordpress.org/reference/functions/wp_next_scheduled/#comment-2141)
 12. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_next_scheduled%2F%23comment-2141)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_next_scheduled%2F%23comment-2141)
 13. Be careful when using arguments! WordPress doesn’t compare them 1:1 so you have
     to pay attention what type these are.
 14. It’s because WP generates a hash out of them: `md5( serialize( $args ) )`
 15. So when you have:
 16.     ```php
         wp_schedule_event( time(), 'daily', 'action_hook', array( 123 ) );
         ```
     
 17. And use a string because ie. the value was taken from the meta:
 18.     ```php
         wp_next_scheduled( 'action_hook', array( '123' ) );
         ```
     
 19. It will return false.
 20.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_next_scheduled%2F%3Freplytocom%3D2141%23feedback-editor-2141)

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