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
This commit is contained in:
Sergey Biryukov 2014-09-02 07:16:41 +00:00
parent 7bdd5a7a2e
commit 52dacfd3a5

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