Restrict Content Pro

rcp_get_customers

Coming soon: Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experience.

Note: This content is provided as a resource within our developer documentation. Because custom code requires highly specific implementation, we encourage you to work with a qualified developer if you need guidance. You can find our recommended consultants here: https://codeable.io/developers/restrict-content-pro

Query for customers.

Parameters

$args (array) – Array of arguments, all of which are optional:

  • $id (int) – A customer ID to only return that customer. Default empty.
  • $id__in (array) – An array of customer IDs. Default empty.
  • $id__not_in (array) – An array of customer IDs to exclude from the results. Default empty.
  • $user_id (int) – A user ID to filter by. Default empty.
  • $user_id__in (array) – An array of user IDs. Default empty.
  • $user_id__not_in (array) – An array of user IDs to exclude from the results. Default empty.
  • $email_verification (string) – Filter by email verification status. Accepts: verified, pending, and none. Default empty.
  • $date_registered_query (array) – Date query clauses to limit customers by. See WP_Date_Query. Default empty.
  • $last_login_query (array) – Date query clauses to limit customers by. See WP_Date_Query. Default empty.
  • $count (bool) – Whether to return a customer count (true) or an array of customer objects (false). Default false.
  • $fields (string) – Item fields to return. Accepts any known column name, or empty to return an array of complete customer objects. Default empty.
  • $number (int) – Limit the number of results. Default 20.
  • $offset (int) – Number of customers to offset. Default 0.
  • $no_found_rows (bool) – Whether to disable the SQL_CALC_FOUND_ROWS query. Default true.
  • $orderby (string) – Accepts id, date_registered, and last_login. Also accepts false, an empty array, or none to disable the ORDER BY clause. Default id.
  • $order (string) – How to order results. Accepts ASC and DESC. Default DESC.
  • $search (string) – Search term(s) to retrieve matching customers for. This searches most of the above customer columns. Default empty.
  • $update_cache (bool) – Whether to prime the cache for found customers. Default false.

Return values

(array) An array of RCP_Customer objects.

Examples

Return customers that match any of the included user ID numbers:

$customers = rcp_get_customers( array(
	'user_id__in' => array( 5, 73, 41, 104 )
) );

Return the customer ID numbers of all customers pending email verification:

$customer_ids = rcp_get_customers( array(
	'email_verification' => 'pending',
	'fields'             => 'id'
) );
Last updated: October 6, 2026
Was this page helpful?
Thanks for the feedback!