Filter hook for the action of listing users

Just like posts with WP_Query and pre_get_posts, there is WP_User_Query and pre_get_users that lets you modify the query parameters for fetching the users. This is the most efficient method of adjusting the list of users.

e.g.


add_action( 'pre_get_users', 'justin_wylllie_pre_get_users' );
function justin_wylllie_pre_get_users( \WP_User_Query $query ): void {
    // ... modify the query object if we're on the relevant page
}

tech