From 52dacfd3a5f4af7fd1bc6451131382a97fd4cc07 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 2 Sep 2014 07:16:41 +0000 Subject: [PATCH] Check $post->post_status directly in _update_posts_count_on_delete() for better performance. props pento. fixes #27952. git-svn-id: https://develop.svn.wordpress.org/trunk@29667 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/ms-blogs.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/ms-blogs.php b/src/wp-includes/ms-blogs.php index 67f66d0a96..e7695db4a4 100644 --- a/src/wp-includes/ms-blogs.php +++ b/src/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; }