Get, find or save users ($users API variable as a function)

This function behaves the same as the $users API variable, though does support an optional shortcut argument for getting a single user or finding multiple users.


// Get a single user (regular and shortcut syntax)
$u = users()->get('karen');
$u = users('karen');

// Find multiple users (regular and shortcut syntax)
$us = users()->find('');
$us = users(''); 


// basic usage
$users = users();

// usage with all arguments
$users = users($selector = '');


selector (optional)string, array, int

Optional selector to send to find() or get()

  • Specify user name or ID to get and return that User
  • Specify a selector string to find all users matching selector (PageArray)

Return value

Users PageArray User mixed

Functions methods and properties

API reference based on ProcessWire core version 3.0.234

Latest news

  • ProcessWire Weekly #510
    In the 510th issue of ProcessWire Weekly we'll check out ProcessWire 3.0.236, introduce a new third party module PageFinder Depth from Robin Sallis, and more. Read on! / 17 February 2024
  • Using date range fields in ProcessWire
    This week we'll take a detailed look at the newest addition to the ProFields set of modules: the Date Range Fieldtype and Inputfield.
    Blog / 24 November 2023
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani