_future_post_hook

函数


_future_post_hook ( $deprecated, $post )
Access
Private
参数
  • (int)
    $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().
    Required:
  • (WP_Post)
    $post
    Post object.
    Required:
定义位置
  • wp-includes/post.php
    , line 7614
引入
2.3.0
弃用

钩子用于安排发布一个标记为未来的文章。

使用的$post属性必须存在,即’ID’和’post_date_gmt’。

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 ) );
}