Purpose
A short-circuit hook. Fired early in MAM_Phone_Data_Pipeline::phase_settings(). If any subscriber returns a non-empty array, the pipeline returns that payload immediately and skips every later phase (no mam_get_phone_data_before_send, no button loop, no home_cats, no phase_finalize cleanup).
Use it when a use-case plugin needs to fully replace the response — bypassing every other subscriber.
⚠️ Frozen contract. No active subscribers in the wild today, but the contract remains because a future use-case plugin might need it.
Signature
$payload = apply_filters( 'mam_local_app_data', array() );
| Parameter | Type | Description |
|---|---|---|
array() |
array | Empty array — convention is “if any subscriber returns a non-empty array, the pipeline returns it” |
Returns: array — empty array (continue normal pipeline) or a fully-formed phone-data response (short-circuit).
When to use
Almost never. The standard extension point is mam_get_phone_data_before_send at the appropriate priority.
The short-circuit is for cases where:
- A use-case plugin needs to serve a totally different response shape (not augmented — replaced)
- Maintenance mode / outage banner needs to bypass normal logic
- A custom auth flow needs to redirect before the normal pipeline runs
Example: maintenance mode override
add_filter( 'mam_local_app_data', function ( $data ) {
$maintenance_until = get_option( 'mam_maintenance_until', 0 );
if ( $maintenance_until <= time() ) {
return $data; // empty array — let the normal pipeline run
}
// Return a minimal maintenance payload — bypasses everything below.
return array(
'maintenance_mode' => true,
'message' => 'We'll be back at ' . date( 'g:ia', $maintenance_until ),
'retry_after_ts' => $maintenance_until,
);
}, 10 );
Gotchas
- The empty-array contract is binding. Returning
nullorfalseis interpreted as “skip my override” (same as empty array). - Returning a non-empty array bypasses output shaping.
mam_replace_null_with_empty_string(), JSON validation, and the cursor mechanism don’t run. You’re fully responsible for a JSON-safe response. - Subscribers don’t compose. First non-empty return wins; later subscribers’ values are not merged.
- Never use this for “augment the response.” That’s
mam_get_phone_data_before_send. The short-circuit hook is for full replacement only. - The mobile client may not handle a degenerate response gracefully. If you short-circuit with an unrecognized shape, the app may crash. Test with the Previewer first.
Related articles
- Phone data pipeline overview
- Phone data pipeline phases
- Hook: mam_get_phone_data_before_send
- Frozen public contracts reference
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-main |
| Applies to plugin version | 2.1.11+ |
| Hook type | filter |
| Audience | PHP developer |
| Frozen contract | yes |
| Last verified | 2026-05-02 |
