From 847328068d8d5fef10cd76df635fafd6b47556d9 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 4 Aug 2023 11:56:16 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp-includes/revision.php`. Follow-up to [24414], [38118], [38433]. Props aristath, poena, afercia, SergeyBiryukov. See #58831. git-svn-id: https://develop.svn.wordpress.org/trunk@56359 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/revision.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/revision.php b/src/wp-includes/revision.php index e8bbcdbce4..d5a5829d7e 100644 --- a/src/wp-includes/revision.php +++ b/src/wp-includes/revision.php @@ -768,7 +768,7 @@ function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) { return $terms; } - if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id + if ( empty( $_REQUEST['post_format'] ) || $post->ID !== $post_id || 'post_format' !== $taxonomy || 'revision' === $post->post_type ) { return $terms; @@ -778,6 +778,7 @@ function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) { $terms = array(); } else { $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ); + if ( $term ) { $terms = array( $term ); // Can only have one post format. } @@ -804,13 +805,10 @@ function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) { return $value; } - if ( empty( $_REQUEST['_thumbnail_id'] ) || - empty( $_REQUEST['preview_id'] ) || - $post->ID != $post_id || - '_thumbnail_id' !== $meta_key || - 'revision' === $post->post_type || - $post_id != $_REQUEST['preview_id'] ) { - + if ( empty( $_REQUEST['_thumbnail_id'] ) || empty( $_REQUEST['preview_id'] ) + || $post->ID !== $post_id || $post_id !== (int) $_REQUEST['preview_id'] + || '_thumbnail_id' !== $meta_key || 'revision' === $post->post_type + ) { return $value; }