Make WordPress Core

Ticket #34977: 34977-in-function.diff

File 34977-in-function.diff, 1.1 KB (added by juanfra, 8 years ago)

Now checking inside the function.

  • src/wp-includes/comment.php

     
    20102010 * @param bool $do_deferred Whether to process previously deferred post comment counts
    20112011 * @return bool|void True on success, false on failure
    20122012 */
    2013 function wp_update_comment_count($post_id, $do_deferred=false) {
     2013function wp_update_comment_count( $post_id, $do_deferred = false ) {
    20142014        static $_deferred = array();
    20152015
     2016        $post_id = (int) $post_id;
     2017        if ( ! $post_id ) {
     2018                return false;
     2019        }
     2020
    20162021        if ( $do_deferred ) {
    2017                 $_deferred = array_unique($_deferred);
     2022                $_deferred = array_unique( $_deferred );
    20182023                foreach ( $_deferred as $i => $_post_id ) {
    2019                         wp_update_comment_count_now($_post_id);
     2024                        wp_update_comment_count_now( $_post_id );
    20202025                        unset( $_deferred[$i] ); /** @todo Move this outside of the foreach and reset $_deferred to an array instead */
    20212026                }
    20222027        }
     
    20262031                return true;
    20272032        }
    20282033        elseif ( $post_id ) {
    2029                 return wp_update_comment_count_now($post_id);
     2034                return wp_update_comment_count_now( $post_id );
    20302035        }
    20312036
    20322037}