Filter
uncanny-automator
automator_status
Filters the automator status output before it is displayed, allowing for customization of the status information.
add_filter( 'automator_status', $callback, 10, 2 );
Description
Filters the status name. This hook fires after the default status name is determined but before it's returned. Developers can use this to customize the display name of an Automator status based on its internal representation, or to handle unknown statuses.
Usage
add_filter( 'automator_status', 'your_function_name', 10, 2 );
Parameters
-
$output(mixed) - This parameter contains the potentially modified status name that will be returned by the filter.
-
$status(mixed) - This parameter contains the potentially modified status name, or the original status if a corresponding name isn't found.
Return Value
The filtered value.
Examples
/**
* Example: Modify the status name for a specific automator status.
*
* This filter allows you to customize the display name of an automator status.
* For instance, you might want to change "completed" to "Successfully Finished".
*
* @param mixed $output The default status name or its representation.
* @param mixed $status The raw status identifier (e.g., a string or an integer).
* @return mixed The modified status name.
*/
add_filter( 'automator_status', function( $output, $status ) {
// Assume $status could be an integer code or a string key.
// This example specifically targets a hypothetical status code '10'.
if ( $status === 10 ) {
// If the default output is the original status code, provide a more descriptive name.
if ( $output === $status ) {
return __( 'Job Archived', 'your-text-domain' );
}
// If the default output is already a string, maybe append something to it.
else {
return $output . ' (Archived)';
}
}
// For any other status, return the original output unchanged.
return $output;
}, 10, 2 ); // Priority 10, accepts 2 arguments.
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/process/class-automator-action-status.php:87
public static function name( $status ) {
$status_names = self::get_all_statuses();
$output = isset( $status_names[ $status ] ) ? $status_names[ $status ] : $status;
return apply_filters( 'automator_status', $output, $status );
}