Action
uncanny-automator-pro
automator_pro_async_action_execution_after_invoked
Fires after an asynchronous Automator Pro action has been invoked and is queued for execution.
add_action( 'automator_pro_async_action_execution_after_invoked', $callback, 10, 1 );
Description
Fires after an asynchronous action has been fully processed and its completion status is determined. Developers can use this hook to perform cleanup, logging, or trigger follow-up actions based on the outcome of the async execution. The `$action_data` parameter contains details about the completed action.
Usage
add_action( 'automator_pro_async_action_execution_after_invoked', 'your_function_name', 10, 1 );
Parameters
-
$action_data(mixed) - This parameter contains the data associated with the asynchronous action being executed.
Examples
// Example: Log details of an asynchronous action that has just been invoked.
// This hook fires after the action has been marked as complete and before the recipe is fully finalized.
add_action( 'automator_pro_async_action_execution_after_invoked', function( $action_data ) {
// Check if $action_data is an array and contains necessary keys
if ( ! is_array( $action_data ) || ! isset( $action_data['ID'] ) || ! isset( $action_data['error_message'] ) ) {
return;
}
$action_id = (int) $action_data['ID'];
$error_message = $action_data['error_message'];
// Log the action ID and any error message for debugging purposes.
// In a real scenario, you might send this to a more robust logging system or notification service.
error_log( sprintf(
'Uncanny Automator Pro: Async action %d invoked. Error: %s',
$action_id,
empty( $error_message ) ? 'None' : esc_html( $error_message )
) );
}, 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
uncanny-automator-pro/src/core/classes/async-actions.php:794
public function maybe_complete_async_action( $process_further, $user_id, $action_data, $recipe_id, $error_message, $recipe_log_id, $args ) {
if ( isset( $action_data['async']['status'] ) && 'completed' === $action_data['async']['status'] ) {
Automator()->db->action->mark_complete( (int) $action_data['ID'], $recipe_log_id, $action_data['completed'], $error_message );
do_action( 'uap_action_completed', $user_id, (int) $action_data['ID'], $recipe_id, $error_message, $args );
$action_data['error_message'] = $error_message;
do_action( 'automator_pro_async_action_execution_after_invoked', $action_data );
Automator()->complete->recipe( $recipe_id, $user_id, $recipe_log_id, $args );
$process_further = false;
}
return $process_further;
}
Internal Usage
Found in src/core/services/logger-auto-remove.php:64:
add_action( 'automator_pro_async_action_execution_after_invoked', array( $this, 'log_async_remove' ), 10, 1 );
Found in uncanny-automator-pro/src/core/loops/process-hooks-callbacks.php:53:
add_action( 'automator_pro_async_action_execution_after_invoked', array( $this, 'complete_scheduled_actions' ) );