Make WordPress Core

Changeset 60981


Ignore:
Timestamp:
10/19/2025 09:42:39 PM (3 months ago)
Author:
peterwilsoncc
Message:

Users: Remove duplicate query generation from count_many_users_posts().

Removes duplicate code generating the WHERE clause and SQL query from the function.

Follow up to [60941].

Props spacedmonkey.
Fixes #63045.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r60941 r60981  
    700700
    701701    if ( false === $count ) {
    702         $where  = get_posts_by_author_sql( $post_type, true, null, $public_only );
    703         $result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N );
     702        $result = $wpdb->get_results( $query, ARRAY_N );
    704703
    705704        $count = array_fill_keys( $users, 0 );
Note: See TracChangeset for help on using the changeset viewer.