gf_has_filters

Description

Determines if a callback has been registered for the specified filter.

Usage

gf_has_filters( array( 'filter_name', $modifier1 ) );

This helper function also has an alias, gf_has_filter, which can be used like so:

gf_has_filter( array( 'filter_name', $modifier1 ) );

Parameters

  • $filter array
    Array containing the filter tag as well as the possible modifiers.

  • $function_to_check bool|callable
    The optional callback to check for.

Returns

Returns boolean for whether the hook has any callbacks registered or if a specific callback is registered.

Examples

$result = gf_has_filters( array( 'gform_pre_render', $form_id ) );
$result = gf_has_filter( array( 'gform_pre_render', $form_id ) );
$result = gf_has_filters( array( 'gform_disable_view_counter', $form_id ), '__return_true' );

Since

The gf_has_filters and gf_has_filter functions were added in Gravity Forms version 2.4.18.

Source Code

These helper functions are located in gravityforms.php