W3cubDocs

/WordPress

_future_post_hook( int $deprecated, WP_Post $post )

Hook used to schedule publication for a post marked for the future.

Description

The $post properties used and must exist are ‘ID’ and ‘post_date_gmt’.

Parameters

$deprecatedintrequired
Not used. Can be set to null. Never implemented. Not marked as deprecated with _deprecated_argument() as it conflicts with wp_transition_post_status() and the default filter for _future_post_hook() .
More Arguments from _future_post_hook( … $deprecated )Not used. Can be set to null. Never implemented. Not marked as deprecated with _deprecated_argument() as it conflicts with wp_transition_post_status() and the default filter for _future_post_hook() .
$postWP_Postrequired
Post object.

Source

function _future_post_hook( $deprecated, $post ) {
	wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) );
	wp_schedule_single_event( strtotime( get_gmt_from_date( $post->post_date ) . ' GMT' ), 'publish_future_post', array( $post->ID ) );
}

Changelog

Version Description
2.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_future_post_hook