When your plugin needs something baked into the native binary — a custom Info.plist entry, a third-party SDK key, a URL scheme, a gradle property — that requirement has to reach the build pipeline before Fastlane assembles the app. MAM Suite exposes exactly one extension point for this: the mam_fastlane_settings filter. This article shows you how to use it.
Goal
Add one or more key/value pairs to the Fastlane settings payload so your plugin’s native build requirements are included when a customer publishes their iOS and/or Android app through Mobile App Manager → Publish Your App.
Background: where the payload comes from
When a customer clicks Submit Publish Request, mam-main hands the build off to WPMAM (the Tiny Screen Labs publishing service). WPMAM’s CI then calls back to the site’s admin-ajax.php endpoint with a one-time fetch token to retrieve the settings it should feed into Fastlane. That fetch is served by mam_main_app_publishing::fastlane_fetch_settings() in mam-main/includes/publish-app/mam-app-publishing.php.
That method builds a $settings array from the persisted publish-app options (app name, bundle ids, team id, version/build numbers, permission strings, branding, feature flags, etc.), runs it through stripslashes_deep(), and then — as the last step before returning the JSON — applies your filter:
$settings = apply_filters( 'mam_fastlane_settings', $settings );
wp_send_json( $settings );
So mam_fastlane_settings is your one chance to add to that payload. It is a frozen contract and the only supported way to extend the publish payload. Do not try to intercept the HTTP exchange or rewrite the persisted options after save.
Prerequisites
- A sibling plugin in the MAM Suite (this filter is meant to be subscribed from another plugin, not from theme or site code).
mam-mainactive. The filter fires insidemam-main‘s publish flow; without it the hook is never applied.- Server-side support on WPMAM for any key you add. Adding a key the build pipeline does not recognize is a silent no-op — the value is carried in the JSON and then ignored. Coordinate the key name and shape with the build pipeline team before you ship it. The set of keys WPMAM understands (Info.plist entries, AndroidManifest entries, gradle properties, custom URL schemes, build settings) is documented on the WPMAM side.
- PHP 8.1+ (the suite’s baseline).
Steps
1. Decide what the native build actually needs
Settle on the exact native artifact first, then work backwards to a payload key:
- An iOS
Info.plistentry (e.g. an SDK key, a usage-description string, a capability flag). - A custom URL scheme for deep-link callbacks.
- An Android manifest entry or gradle property.
- A build setting the pipeline maps onto Fastlane.
Confirm with the build pipeline team which payload key carries that artifact and what value shape it expects.
2. Decide where the value comes from
Most subscribers read the value from a WordPress option your plugin already stores (an API key the admin entered in your settings page, for example). Pull it with get_option(). Keep this read fast — the filter runs during a live fetch from WPMAM’s CI, so a slow source (an outbound HTTP call, an expensive query) blocks the request and can stall the build fetch.
3. Add the filter from your plugin
Register the filter on a hook that runs early enough to be present when the publish fetch happens (e.g. init or your plugin’s bootstrap). The callback receives the settings array and must return it.
add_filter( 'mam_fastlane_settings', function ( array $settings ): array {
$sdk_key = get_option( 'my_plugin_sdk_key' );
if ( $sdk_key ) {
// Coordinate 'ios_extra_plist' / 'MyPluginSDKKey' with the pipeline team.
$settings['ios_extra_plist'] = $settings['ios_extra_plist'] ?? array();
$settings['ios_extra_plist']['MyPluginSDKKey'] = $sdk_key;
}
return $settings;
} );
The example keys
ios_extra_plistandMyPluginSDKKeyare illustrative. Use whatever key the build pipeline team has wired up server-side. A key that WPMAM does not recognize is silently dropped.
4. Be additive — never clobber
The array you receive already contains the customer’s persisted publish settings (app name, bundle ids, permission strings, version numbers, and so on). Add your keys; do not overwrite existing ones. If you need to change a persisted value, change it in Mobile App Manager → Publish Your App and let the page rebuild the payload — this filter is for injection, not for editing the standard fields.
5. Guard array keys before appending
Container keys may not exist until your subscriber creates them. Always coalesce before writing into or appending to them, or you will trip an undefined-key warning:
$settings['custom_url_schemes'] = $settings['custom_url_schemes'] ?? array();
$settings['custom_url_schemes'][] = 'myplugin-callback';
6. Verify the value actually rides along
You cannot see the payload from the admin page, so verify the key is present in what the fetch endpoint returns:
- Temporarily log the filtered array (
error_log( wp_json_encode( $settings ) )inside your callback) and trigger a publish, or - Hit the fetch path with a valid one-time token and inspect the JSON, then
- After the build runs, confirm the native artifact landed (the entry is present in the built app’s
Info.plist, the URL scheme resolves, the SDK initializes). The build is fire-and-forget and async — it completes on WPMAM’s CI 30–60 minutes after submit, so plan to check the resulting build, not the submit response.
Gotchas
- Coordinate new keys with WPMAM. No server-side handler means your key does nothing.
- The filter fires on every publish fetch. Keep the callback cheap; a slow data source blocks the request.
- Don’t override persisted publish options here. Edit them on the Publish Your App page; this hook is additive only.
$settings['ios_extra_plist'](and similar containers) may not exist until you create them — always?? array().- This is the only extension point. Don’t intercept the HTTP exchange or mutate options post-save.
- Build numbers are the admin’s job. This filter does not bump version/build numbers; duplicate build numbers are rejected store-side.
Related
- Hook: mam_fastlane_settings (mam-main hook reference)
- Integration: WPMAM publishing pipeline
- Recipe: Publish your app to iOS and Android
- Frozen public contracts reference
