[wp-trac] [WordPress Trac] #58156: finetune wp_update_comment_count
WordPress Trac
noreply at wordpress.org
Wed Apr 19 05:42:00 UTC 2023
#58156: finetune wp_update_comment_count
-------------------------+-----------------------------
Reporter: Presskopp | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version:
Severity: normal | Keywords: has-patch
Focuses: |
-------------------------+-----------------------------
there is a @todo in {{{function wp_update_comment_count}}} and I see no
reason for not changing the code, which would make it a bit more
effective.
current:
{{{#!php
if ( $do_deferred ) {
$_deferred = array_unique( $_deferred );
foreach ( $_deferred as $i => $_post_id ) {
wp_update_comment_count_now( $_post_id );
unset( $_deferred[ $i ] );
/** @todo Move this outside of the foreach and reset
$_deferred to an array instead */
}
}
}}}
new:
{{{#!php
if ( $do_deferred ) {
$_deferred = array_unique( $_deferred );
foreach ( $_deferred as $i => $_post_id ) {
wp_update_comment_count_now( $_post_id );
}
$_deferred = array(); // for clarity, it is not even needed
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58156>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list