Filter
uncanny-automator
automator_token_parser_whitelisted_tokens
Filters a list of tokens allowed for parsing within the automator.
add_filter( 'automator_token_parser_whitelisted_tokens', $callback, 10, 1 );
Description
Filters the array of tokens that the Automator input parser should *not* attempt to replace. Developers can add custom tokens here that should be treated as literal strings within recipe data, preventing them from being parsed as dynamic placeholders. This is useful for preserving specific formatting or unparsed data.
Usage
add_filter( 'automator_token_parser_whitelisted_tokens', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Example: Add a custom token to be whitelisted, preventing it from being parsed by the Automator plugin.
*
* This is useful if you have custom tokens that you want to display literally within your automations
* without the plugin attempting to replace them with dynamic data.
*
* @param array $whitelisted_tokens An array of tokens that should not be parsed.
* @return array The modified array of whitelisted tokens.
*/
function my_automator_whitelist_custom_token( $whitelisted_tokens ) {
// Add a custom token named 'my_custom_placeholder'.
// This token will now be treated as a literal string, e.g., {{my_custom_placeholder}}.
$whitelisted_tokens[] = 'my_custom_placeholder';
return $whitelisted_tokens;
}
add_filter( 'automator_token_parser_whitelisted_tokens', 'my_automator_whitelist_custom_token', 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/utilities/class-automator-input-parser.php:839
public function get_list_of_tokens_that_should_not_be_parsed() {
// The the token as is. Example: {{your_token_here}}
return apply_filters( 'automator_token_parser_whitelisted_tokens', array() );
}