Signature
apply_filters( 'mam_geodirectory_admin_settings_tabs', array $tabs );
| Parameter | Type | Description |
|---|---|---|
$tabs |
array | Associative array of tab_key => 'Tab label'. |
Returns: array — the modified tab list. You must return it.
Purpose
Adds, removes, or relabels tabs on the Mobile App Manager → Geodirectory admin page. The plugin starts with 'gd-settings' => 'Settings', then appends one entry per registered GD post type (e.g., 'gd_place' => 'GD Places'), then appends 'gd-claim-listings' => 'Claim Listing'. This filter runs at the end of that build, so your callback sees the full default list.
To render the body of a tab you add here, hook Hook: mam_geodirectory_admin_settings_tabcontent{tab} with the matching key.
When it runs
Inside mam_geodirectory_admin_settings::add_page_tabs():
$tabs = [ 'gd-settings' => 'Settings' ];
foreach ( geodir_get_posttypes( 'object' ) as $index => $posts ) {
$tabs[ $index ] = 'GD ' . $posts->labels->name;
}
$tabs['gd-claim-listings'] = 'Claim Listing';
$tabs = apply_filters( 'mam_geodirectory_admin_settings_tabs', $tabs );
The filter runs once per admin page load. The active tab is read from $_REQUEST['tab'] and matched against the resulting keys.
Example: add a custom tab
add_filter( 'mam_geodirectory_admin_settings_tabs', 'my_app_add_diagnostics_tab' );
function my_app_add_diagnostics_tab( $tabs ) {
$tabs['my-app-diagnostics'] = 'Diagnostics';
return $tabs;
}
add_filter( 'mam_geodirectory_admin_settings_tab_content_my-app-diagnostics', 'my_app_diagnostics_body', 10, 2 );
function my_app_diagnostics_body( $html_line, $tab ) {
$html_line .= '<div class="tsl-admin-settings-holder">';
$html_line .= '<h3>Diagnostics</h3>';
$html_line .= '<p>...your diagnostics HTML here...</p>';
$html_line .= '</div>';
return $html_line;
}
The new tab appears between “Claim Listing” and any prior plugin’s tabs. Clicking it renders your custom body.
Gotchas
- Tab keys must be unique. Duplicate keys overwrite earlier entries.
- Sanitize as you read. The active tab is read with
sanitize_key(), so keys must be lowercase, alphanumeric, with_or-. Anything else is silently mangled. - Always return the array. Forgetting
returnstrips every tab. - The “Save” form on the global Settings tab posts back to whichever tab is active. Custom tabs that include their own form should set the right hidden
tabfield to round-trip correctly.
Verification
This article was last verified against:
- Plugin:
mam-geodirectoryv2.1.5 - Source:
includes/mam_geodirectory_admin_settings.php—add_page_tabs()
Re-verify whenever the default tab list changes (e.g., new built-in tabs) or the page no longer calls this filter.
Related articles
- Plugin: mam-geodirectory
- Recipe: Configure the GeoDirectory settings page
- Hook: mam_geodirectory_admin_settings_tabcontent{tab}
- Hook: mam_geodirectory_admin_settings
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-geodirectory |
| Applies to plugin version | 2.1.5+ |
| Category | Extending MAM Suite |
| Hook type | filter |
| Audience | PHP developer |
| Last verified | 2026-05-01 |
