Filter
uncanny-automator
automator_legacy_ajax_action_prefixes
Filters the list of prefixes used by legacy Automator AJAX actions.
add_filter( 'automator_legacy_ajax_action_prefixes', $callback, 10, 1 );
Description
Filters legacy AJAX action prefixes used by integrations. Developers can add or modify these prefixes to register their own legacy AJAX actions or to support older integration versions, especially before the `automator_` naming convention was adopted.
Usage
add_filter( 'automator_legacy_ajax_action_prefixes', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Adds a new legacy AJAX action prefix for a custom integration.
*
* This function demonstrates how to add a new prefix to the 'automator_legacy_ajax_action_prefixes'
* filter. This is useful for custom integrations or add-ons that use older AJAX action naming
* conventions and need to be recognized by the Automator plugin.
*
* @param array $prefixes The existing array of legacy AJAX action prefixes.
* @return array The modified array of legacy AJAX action prefixes, including the new one.
*/
function my_custom_automator_legacy_prefixes( $prefixes ) {
// Add a new prefix for our hypothetical custom integration named 'my-custom-integration'.
// This allows AJAX actions like 'my-custom-integration_fetch_data' to be recognized.
$prefixes[] = 'my-custom-integration_';
return $prefixes;
}
// Add the filter to the 'automator_legacy_ajax_action_prefixes' hook.
// The priority is set to 10 (default).
// The function accepts one argument ($prefixes), so the accepted args is 1.
add_filter( 'automator_legacy_ajax_action_prefixes', 'my_custom_automator_legacy_prefixes', 10, 1 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/core/lib/recipe-parts/class-recipe-manifest.php:406
private function is_automator_ajax() {
if ( ! wp_doing_ajax() ) {
return false;
}
// Nonce verification intentionally skipped — routing decision during bootstrap.
$action = automator_request_input( 'action' );
// Standard Automator AJAX actions (automator_*, uap_*).
if ( '' !== $action && ( 0 === strpos( $action, 'automator' ) || 0 === strpos( $action, 'uap_' ) ) ) {
return true;
}
// Legacy integration AJAX actions that predate the automator_/uap_ naming convention.
// These are registered by integrations like MailChimp, Active Campaign, LearnDash, etc.
// Filterable so Pro and addons can register their own legacy prefixes.
// @todo Remove once all integrations are migrated to automator_* naming convention.
$legacy_prefixes = apply_filters(
'automator_legacy_ajax_action_prefixes',
array(
'select_', // Field chaining: select_mcgroupslist_from_mclist, select_form_fields_*, etc.
'get_', // Data fetch: get_mailchimp_audience_fields, get_event_meeting_*, get_all_*, etc.
'active-campaign-', // Active Campaign settings.
'mailchimp-', // MailChimp settings: mailchimp-regenerate-webhook-key.
'whatsapp-', // WhatsApp settings: whatsapp-regenerate-webhook-key.
'gtt_', // GoToTraining: gtt_disconnect.
'gtw_', // GoToWebinar: gtw_disconnect.
'helpscout_', // Help Scout: helpscout_fetch_conversations.
'ua_', // Legacy UA prefix: ua_facebook_group_list_groups.
'uo_', // Legacy UO prefix: uo_mailchimp_disconnect.
'lifter_lms_', // LifterLMS: lifter_lms_retrieve_*.
'ameliabooking_', // Amelia: ameliabooking_service_category_endpoint.
'facebook_lead', // Facebook Lead Ads.
'webhook_url_', // Pro webhooks: webhook_url_get_webhook_url.
'get_samples_', // Pro webhooks: get_samples_get_webhook_url.
'cancel_async_run', // Pro async actions.
'auto_plugin_install', // Pro auto-installer.
'recipe-triggers', // Activity log.
'recipe-actions', // Activity log.
'prune_logs', // Log pruning.
'retrieve_', // Pro loop filters: retrieve_post_types, retrieve_taxonomies, etc.
)
);
foreach ( $legacy_prefixes as $prefix ) {
if ( 0 === strpos( $action, $prefix ) ) {
return true;
}
}
// Recipe editor AJAX — integration-specific actions (e.g. retrieve_fields_from_form_id)
// always include both recipe_id AND item_id. Full load required so setup() hooks are
// available. Requires both to avoid false-positives from other plugins that use
// generic parameter names like item_id (e.g. WooCommerce order item operations).
//
// Source of truth: field/index.js → getAjaxRequestData() always sends both.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( ! empty( $_REQUEST['recipe_id'] ) && ! empty( $_REQUEST['item_id'] ) ) {
return true;
}
return false;
}