Custom Automation Actions

Custom automation actions are registered with the elzo_forms_pro_automation_actions filter. Each action class must implement ElzoFormsPro\Automation\Actions\ActionInterface.

Interface methods

  • get_type(): string
  • get_label(): string
  • get_settings_schema(): array
  • execute(array $settings, array $context): array

Register an action

add_filter('elzo_forms_pro_automation_actions', function ($actions) {
    $actions[] = MyPlugin\Automation\Create_Post_Action::class;
    return $actions;
});

Example action result

return [
    'status' => 'success',
    'message' => 'Post created.',
    'context_patch' => [
        'created_post' => [
            'id' => $post_id,
            'url' => get_permalink($post_id),
        ],
    ],
];

Use context_patch when a later action or condition should be able to use the result of this action.