Filter uncanny-automator

automator_skip_action_registration

Filters whether a specific action should be registered for an integration.

add_filter( 'automator_skip_action_registration', $callback, 10, 4 );

Description

Filters whether to skip registering a specific Automator action. Return `true` to prevent registration. Useful for conditionally disabling actions based on the action object, integration code, or integration instance.


Usage

add_filter( 'automator_skip_action_registration', 'your_function_name', 10, 4 );

Parameters

$skip_uap_action_registration (mixed)
This boolean parameter, when set to `true`, indicates that the registration of the current action should be skipped.
$uap_action (mixed)
This boolean parameter is used to determine whether the registration of a specific automator action should be skipped.
$integration_code (mixed)
This parameter represents the specific action object being registered.
$integration (mixed)
This parameter contains the integration code for the current action being processed.

Return Value

The filtered value.


Examples

// Example: Skip registering a specific WordPress Automator action if it's related to a certain integration and meets a condition.
add_filter(
	'automator_skip_action_registration',
	function ( $skip_uap_action_registration, $uap_action, $integration_code, $integration ) {
		// Check if we are dealing with the 'user_login' action.
		if ( isset( $uap_action['id'] ) && 'user_login' === $uap_action['id'] ) {
			// Check if the integration code is 'my_custom_plugin'.
			if ( 'my_custom_plugin' === $integration_code ) {
				// Further check a custom meta value associated with the integration or action.
				// This is a hypothetical check, assume $integration['meta'] or $uap_action['meta'] exists.
				if ( isset( $integration['meta']['disable_user_login_automation'] ) && true === $integration['meta']['disable_user_login_automation'] ) {
					// If the condition is met, skip registering this action.
					return true;
				}
			}
		}

		// Otherwise, return the original value, allowing registration.
		return $skip_uap_action_registration;
	},
	10, // Priority
	4  // Accepted arguments count
);

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-registration.php:323

$skip_uap_action_registration = false;
		$skip_uap_action_registration = apply_filters_deprecated(
			'skip_uap_action_registration',
			array( $skip_uap_action_registration, $uap_action, $integration_code, $integration ),
			'3.0',
			'automator_skip_action_registration'
		);
		$skip_uap_action_registration = apply_filters( 'automator_skip_action_registration', $skip_uap_action_registration, $uap_action, $integration_code, $integration );

		if ( true === $skip_uap_action_registration ) {
			return null;
		}

		/**
		 * Use this hook to modify the uap action before it it error checked and registered


Scroll to Top