Filter
rpress_customer_views
On this page
Filters the registered views of the admin customer detail screen.
Maps a view slug (the view query argument on the Customers page) to a callable. When the requested view is registered, the customer detail wrapper is rendered and the callable is invoked with the loaded RPRESS_Customer. The defaults overview, orders, notes, tools and delete are added at priority 1 and all use rpress_customers_view. Add a slug here to make a new view reachable.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$views | array | View slugs mapped to callables. Empty on entry; the built-in views are added by a priority 1 callback. |
Return value#
array. The view slug to callable map.
Example#
function my_customer_views( $views ) {
$views['loyalty'] = 'my_render_customer_loyalty_view';
return $views;
}
add_filter( 'rpress_customer_views', 'my_customer_views' );
function my_render_customer_loyalty_view( $customer ) {
echo '<div class="rp-card"><p>' . esc_html( sprintf( 'Loyalty view for %s', $customer->email ) ) . '</p></div>';
}
Notes#
The callback receives a single RPRESS_Customer argument. The function that builds the tab list, rpress_customer_tabs(), is not called by the current customer screen, so the rpress_customer_tabs filter has no visible effect there.
Source#
Applied in:
includes/admin/customers/customers.php(line 49), inrpress_customer_views()
