Filter uncanny-automator

automator_skip_meta_parsing_keys

Filters which meta keys should be skipped during parsing for specific automator actions.

add_filter( 'automator_skip_meta_parsing_keys', $callback, 10, 1 );

Description

Filters the array of meta keys that should be skipped during the parsing process for action meta. Developers can use this to prevent specific meta fields from being processed by the automator, for example, if they contain sensitive or non-parsable data.


Usage

add_filter( 'automator_skip_meta_parsing_keys', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

// Prevent certain meta keys from being parsed for tokens.
// This can be useful for meta fields that contain dynamic data
// that shouldn't be treated as a literal string for token replacement.
add_filter( 'automator_skip_meta_parsing_keys', 'my_custom_automator_skip_meta_parsing_keys', 10, 1 );

/**
 * Adds custom meta keys to the list of keys that should be skipped during meta parsing.
 *
 * @param array $default_keys An array of meta keys to skip by default.
 * @return array The modified array of meta keys to skip.
 */
function my_custom_automator_skip_meta_parsing_keys( $default_keys ) {
    // Add a custom meta key to the list of keys to skip.
    // For example, if you have a meta field storing a timestamp or a complex JSON object
    // that you don't want to parse for tokens, you can add its meta key here.
    $custom_keys_to_skip = array(
        'my_plugin_specific_timestamp_field',
        'my_plugin_complex_data_field',
    );

    // Merge the default keys with our custom keys.
    $all_keys_to_skip = array_unique( array_merge( $default_keys, $custom_keys_to_skip ) );

    return $all_keys_to_skip;
}

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/actions/trait-action-parser.php:92

protected function pre_parse() {
		$not_tokens = apply_filters(
			'automator_skip_meta_parsing_keys',
			array(
				'code',
				'integration',
				'sentence',
				'uap_action_version',
				'integration_name',
				'sentence',
				'sentence_human_readable',
			)
		);

		$this->set_not_token_keys( $not_tokens );
		$this->set_wpautop( $this->is_wpautop() );
		$this->set_do_shortcode( true );
	}


Scroll to Top