Filter
uncanny-automator
automator_should_load_all_integrations
Filters whether to load all automator integrations, preventing loading if a false value is returned.
add_filter( 'automator_should_load_all_integrations', $callback, 10, 1 );
Description
Filters whether all integrations should be loaded by default. Return `true` to force loading all integrations, overriding the default behavior that only loads necessary ones. This can be useful for debugging or custom setups.
Usage
add_filter( 'automator_should_load_all_integrations', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Conditionally load all integrations based on a custom condition.
*
* By default, this filter returns false, meaning integrations are not loaded by default
* unless a specific condition is met. This example demonstrates how you might
* enable loading all integrations only on a development environment or during
* plugin testing.
*
* @param bool $load_all_integrations The current value of the filter. Defaults to false.
* @return bool True to load all integrations, false otherwise.
*/
add_filter( 'automator_should_load_all_integrations', function( $load_all_integrations ) {
// Check if the current environment is a development one.
// This is a common scenario where you might want to load all integrations for testing.
if ( defined( 'WP_ENV' ) && 'development' === WP_ENV ) {
return true;
}
// You could also check for a specific user role or a custom constant for specific debugging.
// For example:
// if ( current_user_can( 'manage_options' ) ) {
// return true;
// }
// if ( defined( 'MY_DEBUG_MODE' ) && MY_DEBUG_MODE ) {
// return true;
// }
// If none of the custom conditions are met, return the default value.
return $load_all_integrations;
}, 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/recipe-parts/class-recipe-manifest.php:306
private function is_escape_hatch_enabled() {
return ( defined( 'AUTOMATOR_LOAD_ALL_INTEGRATIONS' ) && AUTOMATOR_LOAD_ALL_INTEGRATIONS )
|| apply_filters( 'automator_should_load_all_integrations', false );
}