From 8cc6ad5066df3759bd9ed8c952fa05c9bbd80f94 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 2 Sep 2014 07:17:17 +0000 Subject: [PATCH] Check $post->post_status directly in _update_posts_count_on_delete() for better performance. props pento. fixes #27952. Built from https://develop.svn.wordpress.org/trunk@29667 git-svn-id: http://core.svn.wordpress.org/trunk@29441 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-blogs.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php index 67f66d0a96..e7695db4a4 100644 --- a/wp-includes/ms-blogs.php +++ b/wp-includes/ms-blogs.php @@ -917,7 +917,9 @@ function _update_blog_date_on_post_delete( $post_id ) { * @param int $post_id Post ID. */ function _update_posts_count_on_delete( $post_id ) { - if ( 'publish' !== get_post_field( 'post_status', $post_id ) ) { + $post = get_post( $post_id ); + + if ( ! $post || 'publish' !== $post->post_status ) { return; }