_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:
定義位置
相關方法
_save_post_hook_publish_post_hook_restore_wpautop_hookwp_set_post_lockwp_filter_post_kses
引入
2.3.0
棄用
-

future_post_hook: 這是一個鉤子,在未來的文章釋出後啟動。它可以用來在文章釋出後執行動作。

鉤子用於安排釋出一個標記為未來的文章。

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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 ) );
}
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 ) ); }
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 ) );
}

常見問題

FAQs
檢視更多 >