Signature
apply_filters( 'mam_gd_events_exclude_from_map', bool $exclude );
| Parameter | Type | Description |
|---|---|---|
$exclude |
bool | Default false — events are included on map output. |
Returns: bool — true to exclude events from map content; false to include them.
Purpose
Stops gd_event posts from appearing on the map content type. By default, when an admin picks a gd_event taxonomy term as the content source for a Map content type, the events are rendered as map markers. This filter lets you override that — useful when you want one map for venues and a separate calendar for events, with no cross-contamination.
When it runs
In mam_geodirectory_content::get_data_for_app():
$exclude_events_from_map = apply_filters( 'mam_gd_events_exclude_from_map', false );
Fires once per request, before the per-listing loop. The result is then passed to finalize_listing_base_data() and downstream finalisers, which use it to skip event-only setup for map output.
Examples
Always exclude events from maps
add_filter( 'mam_gd_events_exclude_from_map', '__return_true' );
Exclude only on certain content types
There is no built-in way to inspect the current vc_type here — the filter doesn’t pass it. Use the global $_REQUEST to detect the surface or override the listings via Hook: mam_geodirectory_explcit_listings for full control.
Gotchas
- Affects every map request site-wide. This filter is global; there is no per-content-type override path through this hook alone. A naive
__return_trueremoves events from every map. - Doesn’t affect the calendar surface. Calendar requests use
get_events_only()which forces the post type togd_event; this filter is only consulted in the standard list/map path. - Bool only. Truthy returns work, but always return a real bool.
Verification
This article was last verified against:
- Plugin:
mam-geodirectoryv2.1.5 - Source:
content-classes/local-app-geodirectory-v2-class.php(line 495)
Re-verify whenever the call site moves, the per-listing finaliser stops consulting $exclude_events_from_map, or events stop being included in the map by default.
Related articles
- Plugin: mam-geodirectory
- Content type: GeoDirectory list and map
- Mobile listing data shape
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 |
