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
This commit is contained in:
Sergey Biryukov 2014-09-02 07:17:17 +00:00
parent 683238567d
commit 8cc6ad5066

View File

@ -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;
}