Make WordPress Core

Changeset 44473


Ignore:
Timestamp:
01/08/2019 09:48:09 AM (8 years ago)
Author:
pento
Message:

Users: Add the pre_count_users filter.

Props spacedmonkey.
Fixes #43693.

File:
1 edited

Legend:

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

    r44470 r44473  
    883883                $site_id = get_current_blog_id();
    884884        }
     885
     886        /**
     887         * Filter the user count before queries are run. Return a non-null value to cause count_users()
     888         * to return early.
     889         *
     890         * @since 5.1.0
     891         *
     892         * @param null|string $result   Default null.
     893         * @param string      $strategy Optional. The computational strategy to use when counting the users.
     894         *                              Accepts either 'time' or 'memory'. Default 'time'.
     895         * @param int|null    $site_id  Optional. The site ID to count users for. Defaults to the current site.
     896         */
     897        $pre = apply_filters( 'pre_count_users', null, $strategy, $site_id );
     898
     899        if ( null !== $pre ) {
     900                return $pre;
     901        }
     902
    885903        $blog_prefix = $wpdb->get_blog_prefix( $site_id );
    886904        $result      = array();
Note: See TracChangeset for help on using the changeset viewer.