From 16b7936d9fba683e32f8aa7d84aa139ce04da9ea Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 15 Jul 2024 01:59:16 +0000 Subject: [PATCH] Docs: Correct documentation for `_wp_preview_meta_filter()`. The `$single` parameter is passed via the `get_post_metadata` filter and has no default value. Includes minor code layout fixes for consistency with the formatting of other long conditionals in core. Follow-up to [56714]. Props rodrigosprimo. Fixes #61645. Built from https://develop.svn.wordpress.org/trunk@58717 git-svn-id: http://core.svn.wordpress.org/trunk@58119 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/revision.php | 14 +++++++------- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wp-includes/revision.php b/wp-includes/revision.php index 065278b5f8..2747ea9267 100644 --- a/wp-includes/revision.php +++ b/wp-includes/revision.php @@ -1107,24 +1107,24 @@ function _wp_upgrade_revisions_of_post( $post, $revisions ) { * @param mixed $value Meta value to filter. * @param int $object_id Object ID. * @param string $meta_key Meta key to filter a value for. - * @param bool $single Whether to return a single value. Default false. + * @param bool $single Whether to return a single value. * @return mixed Original meta value if the meta key isn't revisioned, the object doesn't exist, * the post type is a revision or the post ID doesn't match the object ID. * Otherwise, the revisioned meta value is returned for the preview. */ function _wp_preview_meta_filter( $value, $object_id, $meta_key, $single ) { - $post = get_post(); - if ( - empty( $post ) || - $post->ID !== $object_id || - ! in_array( $meta_key, wp_post_revision_meta_keys( $post->post_type ), true ) || - 'revision' === $post->post_type + + if ( empty( $post ) + || $post->ID !== $object_id + || ! in_array( $meta_key, wp_post_revision_meta_keys( $post->post_type ), true ) + || 'revision' === $post->post_type ) { return $value; } $preview = wp_get_post_autosave( $post->ID ); + if ( false === $preview ) { return $value; } diff --git a/wp-includes/version.php b/wp-includes/version.php index ef86314d22..18aed05749 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-58716'; +$wp_version = '6.7-alpha-58717'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.