wp_save_revisioned_meta_fields

The timeline below displays how wordpress function wp_save_revisioned_meta_fields has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.4

/**
 * Save the revisioned meta fields.
 *
 * @since 6.4.0
 *
 * @param int $revision_id The ID of the revision to save the meta to.
 * @param int $post_id     The ID of the post the revision is associated with.
 */
function wp_save_revisioned_meta_fields($revision_id, $post_id)
{
    $post_type = get_post_type($post_id);
    if (!$post_type) {
        return;
    }
    foreach (wp_post_revision_meta_keys($post_type) as $meta_key) {
        if (metadata_exists('post', $post_id, $meta_key)) {
            _wp_copy_post_meta($post_id, $revision_id, $meta_key);
        }
    }
}