Signature
apply_filters( 'mam_geodirectory_admin_settings', string $html_line );
| Parameter | Type | Description |
|---|---|---|
$html_line |
string | HTML accumulated for the global Settings tab so far, including all the built-in dropdowns and inputs. |
Returns: string — the full HTML. You must return it.
Purpose
Append a custom block of admin UI to the bottom of the Settings tab (the gd-settings tab key). Useful for adding a few extra options that don’t justify a full dedicated tab.
Unlike Hook: mam_geodirectory_admin_settings_tabcontent{tab}, this filter does not replace the built-in content — it only appends to it.
When it runs
Inside mam_geodirectory_admin_settings::create_admin_page(), only when the active tab is gd-settings:
} else {
$options = array();
/* ... built-in dropdowns and inputs ... */
$html_line = apply_filters( 'mam_geodirectory_admin_settings', $html_line );
}
The filter runs once per page load, after the built-in date-format, social-icons-only, ticketing-URL, and notification-label inputs have been rendered.
Example: add a custom inline option
add_filter( 'mam_geodirectory_admin_settings', 'my_app_extra_settings' );
function my_app_extra_settings( $html_line ) {
$current = get_option( 'my_app_show_directory_legend', 'no' );
$html_line .= '<table class="tsl-admin-pref-table"><tr>';
$html_line .= '<td class="tsl-admin-pref-table-heading">Show directory legend?</td>';
$html_line .= '<td>';
$html_line .= sprintf(
'<select name="my_app_show_directory_legend"><option value="yes" %s>Yes</option><option value="no" %s>No</option></select>',
selected( $current, 'yes', false ),
selected( $current, 'no', false )
);
$html_line .= '</td></tr></table>';
return $html_line;
}
The plugin’s check_save() loop walks $this->settings_array and only saves keys it knows about, so your custom option will not be persisted by the built-in save flow. Use a separate admin_init hook to save it, or hook a save callback at lower priority.
Gotchas
- Save your own options. The plugin’s built-in save iterates
settings_arrayand only saves keys it registered. Custom options need their own save path — the simplest is to listen for the same_wpnonce(mam_geodirectory_settings_save) and persist your own keys withupdate_option(). - Append-only is by design. This filter exists for cosmetic additions. For new tabs use Hook: mam_geodirectory_admin_settings_tabs instead.
- Active tab gate. The filter only fires when
tab === 'gd-settings'. On other tabs, your callback is skipped entirely.
Verification
This article was last verified against:
- Plugin:
mam-geodirectoryv2.1.5 - Source:
includes/mam_geodirectory_admin_settings.php—create_admin_page()
Re-verify whenever the global Settings tab’s rendering structure changes (e.g., new built-in inputs added below this filter call) or the filter is moved.
Related articles
- Plugin: mam-geodirectory
- Recipe: Configure the GeoDirectory settings page
- Hook: mam_geodirectory_admin_settings_tabs
- Hook: mam_geodirectory_admin_settings_tabcontent{tab}
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 |
