From 6d1bd80da84dedda837016fd5d674dc26f98dbd4 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 20 Aug 2025 15:01:31 +0000 Subject: [PATCH] Posts, Post Types: Avoid an extra database query in `WP_Post` for a negative post ID. Follow-up to [21559]. Props bor0, akeda, SergeyBiryukov. Fixes #63850. Built from https://develop.svn.wordpress.org/trunk@60654 git-svn-id: http://core.svn.wordpress.org/trunk@59990 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-post.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-post.php b/wp-includes/class-wp-post.php index 2ce3144a86..7c8a71eee2 100644 --- a/wp-includes/class-wp-post.php +++ b/wp-includes/class-wp-post.php @@ -233,7 +233,7 @@ final class WP_Post { global $wpdb; $post_id = (int) $post_id; - if ( ! $post_id ) { + if ( $post_id <= 0 ) { return false; } diff --git a/wp-includes/version.php b/wp-includes/version.php index bdf3a85e56..bb491dc0fe 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.9-alpha-60653'; +$wp_version = '6.9-alpha-60654'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.