Skip to content
Docs
Get RestroPress

Filter

rpress_reports_intelligence_tabs

Updated
On this page

Filters the tabs shown on the reports screen.

Runs when the reports screen builds its tab list. Keys are tab IDs and values are labels; the first tab in the default list is Overview and an Export tab is appended for users with the export_shop_reports capability. The active tab content is printed by the rpress_reports_tab_{$active_tab} action, and an unknown tab ID falls back to the overview tab.

Parameters#

ParameterTypeDescription
$tabsarrayArray of tab ID => label.

Return value#

array. The tab ID => label array.

Example#

function my_reports_tab( $tabs ) {
	$tabs['loyalty'] = esc_html__( 'Loyalty', 'my-plugin' );
	return $tabs;
}
add_filter( 'rpress_reports_intelligence_tabs', 'my_reports_tab', 10, 1 );

function my_render_loyalty_tab() {
	echo '<div class="rp-card"><h2>' . esc_html__( 'Loyalty', 'my-plugin' ) . '</h2></div>';
}
add_action( 'rpress_reports_tab_loyalty', 'my_render_loyalty_tab' );

Source#

Applied in:

  • includes/admin/reporting/class-rpress-reports-intelligence.php (line 42), in RPRESS_Reports_Intelligence::get_tabs()

See also#

Was this page helpful?