Make WordPress Core


Ignore:
Timestamp:
09/24/2018 10:53:12 PM (8 years ago)
Author:
SergeyBiryukov
Message:

Users: Pass the current WP_User_Query instance to found_users_query filter.

Props spacedmonkey.
Fixes #43679.

File:
1 edited

Legend:

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

    r42876 r43660  
    601601                }
    602602
    603                 /**
    604                  * Filters SELECT FOUND_ROWS() query for the current WP_User_Query instance.
    605                  *
    606                  * @since 3.2.0
    607                  *
    608                  * @global wpdb $wpdb WordPress database abstraction object.
    609                  *
    610                  * @param string $sql The SELECT FOUND_ROWS() query for the current WP_User_Query.
    611                  */
    612603                if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
    613                         $this->total_users = (int) $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) );
     604                        /**
     605                         * Filters SELECT FOUND_ROWS() query for the current WP_User_Query instance.
     606                         *
     607                         * @since 3.2.0
     608                         * @since 4.9.9 Added the `$this` parameter.
     609                         *
     610                         * @global wpdb $wpdb WordPress database abstraction object.
     611                         *
     612                         * @param string $sql         The SELECT FOUND_ROWS() query for the current WP_User_Query.
     613                         * @param WP_User_Query $this The current WP_User_Query instance.
     614                         */
     615                        $found_users_query = apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()', $this );
     616
     617                        $this->total_users = (int) $wpdb->get_var( $found_users_query );
    614618                }
    615619
Note: See TracChangeset for help on using the changeset viewer.