wp_restore_post_revision_meta

函数
wp_restore_post_revision_meta ( $post_id, $revision_id )
参数
  • (int) $post_id The ID of the post to restore the meta to.
    Required:
  • (int) $revision_id The ID of the revision to restore the meta from.
    Required:
定义位置
相关方法
wp_restore_post_revisionwp_get_post_revisionwp_delete_post_revisionwp_get_post_revisionswp_post_revision_meta_keys
引入
6.4.0
弃用
-

恢复文章的修订元值。

function wp_restore_post_revision_meta( $post_id, $revision_id ) {
	$post_type = get_post_type( $post_id );
	if ( ! $post_type ) {
		return;
	}

	// Restore revisioned meta fields.
	foreach ( wp_post_revision_meta_keys( $post_type ) as $meta_key ) {

		// Clear any existing meta.
		delete_post_meta( $post_id, $meta_key );

		_wp_copy_post_meta( $revision_id, $post_id, $meta_key );
	}
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-14 09:36:28

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: