Skip to content
Docs
Get RestroPress

Filter

rpress_api_fooditem_logs

Updated
On this page

Filters the complete fooditem logs response returned by the API.

Runs at the end of RPRESS_API::get_fooditem_logs() after every log entry has been passed through rpress_api_fooditem_log_item. The array is keyed by 'fooditem_logs'.

Parameters#

ParameterTypeDescription
$fooditemsarrayResponse data with the log entries under 'fooditem_logs'.
$thisRPRESS_APIThe API instance handling the request.

Return value#

array. The logs response.

Example#

function my_api_fooditem_logs( $fooditems, $api ) {
	$fooditems['log_count'] = isset( $fooditems['fooditem_logs'] ) ? count( $fooditems['fooditem_logs'] ) : 0;
	return $fooditems;
}
add_filter( 'rpress_api_fooditem_logs', 'my_api_fooditem_logs', 10, 2 );

Notes#

Not applied when no logs are found; an error array is returned instead.

Source#

Applied in:

  • includes/api/class-rpress-api.php (line 1372), in RPRESS_API::get_fooditem_logs()

See also#

Was this page helpful?