Filter uncanny-automator-pro

automator_pro_loop_registry_query_disabled

Filters the loop registry query to disable it, allowing modification of query arguments before execution.

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

Description

Fires to determine if the loop process registry query is disabled. Developers can return `true` to disable the registry query, preventing it from being executed. This is useful for performance optimization or specific use cases where registry data isn't needed.


Usage

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

Return Value

The filtered value.


Examples

add_filter( 'automator_pro_loop_registry_query_disabled', 'my_custom_disable_loop_registry_query', 10, 1 );
/**
 * Example function to disable the loop registry query for specific conditions.
 *
 * This function demonstrates how to conditionally disable the loop registry query
 * based on a custom option or user role. In this example, we'll disable it
 * if a specific plugin option is set to true.
 *
 * @param bool $disabled The current disabled status of the registry query.
 * @return bool True if the registry query should be disabled, false otherwise.
 */
function my_custom_disable_loop_registry_query( $disabled ) {
    // Check if a custom option is set to disable the loop registry query.
    // Replace 'my_custom_automator_settings' with your actual option name.
    // Replace 'disable_loop_registry' with your actual setting key.
    $custom_disable_setting = get_option( 'my_custom_automator_settings' );

    if ( isset( $custom_disable_setting['disable_loop_registry'] ) && true === $custom_disable_setting['disable_loop_registry'] ) {
        // If the custom setting is true, disable the loop registry query.
        return true;
    }

    // Otherwise, return the original disabled status.
    return $disabled;
}

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

uncanny-automator-pro/src/core/loops/loop-process-registry.php:64

public static function is_loop_registry_query_disabled() {
		return (bool) apply_filters( 'automator_pro_loop_registry_query_disabled', false );
	}

Scroll to Top