wp_save_post_revision_on_insert

函式
wp_save_post_revision_on_insert ( $post_id, $post, $update )
引數
  • (int) $post_id The post id that was inserted.
    Required:
  • (WP_Post) $post The post object that was inserted.
    Required:
  • (bool) $update Whether this insert is updating an existing post.
    Required:
定義位置
相關方法
wp_save_post_revisionwp_restore_post_revision_metawp_get_post_revisionswp_is_post_revisionwp_list_post_revisions
引入
6.4.0
棄用
-

在完成所有修改後,儲存對文章的修訂。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_save_post_revision_on_insert( $post_id, $post, $update ) {
if ( ! $update ) {
return;
}
if ( ! has_action( 'post_updated', 'wp_save_post_revision' ) ) {
return;
}
wp_save_post_revision( $post_id );
}
function wp_save_post_revision_on_insert( $post_id, $post, $update ) { if ( ! $update ) { return; } if ( ! has_action( 'post_updated', 'wp_save_post_revision' ) ) { return; } wp_save_post_revision( $post_id ); }
function wp_save_post_revision_on_insert( $post_id, $post, $update ) {
	if ( ! $update ) {
		return;
	}

	if ( ! has_action( 'post_updated', 'wp_save_post_revision' ) ) {
		return;
	}

	wp_save_post_revision( $post_id );
}

常見問題

FAQs
檢視更多 >