Skip to content
Docs
Get RestroPress

Filter

rpress_api_customers

Updated
On this page

Filters the customers data returned by the customers API endpoint.

Runs at the end of a customers request when customers were found. The array has a customers key holding a list of customer data arrays, or a single customer when one was requested. Error responses are returned before the filter runs.

Parameters#

ParameterTypeDescription
$customersarrayAPI response data containing the customers list.
$apiRPRESS_APIThe API object handling the request.

Return value#

array. The customers response data.

Example#

function my_api_customers( $customers, $api ) {
	$customers['generated_by'] = 'my-plugin';
	return $customers;
}
add_filter( 'rpress_api_customers', 'my_api_customers', 10, 2 );

Notes#

Fired from the base API class and the v2 class with the same signature.

Source#

Applied in:

  • includes/api/class-rpress-api-v2.php (line 249), in RPRESS_API_V2::get_customers()
  • includes/api/class-rpress-api.php (line 837), in RPRESS_API::get_customers()

See also#

Was this page helpful?