gpeb_selected_user_filters

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Set default values for user-facing filters.
  5. Since

Description

Filter the selected user filters.

Usage

Filter the selected user filters for all Entries blocks.

add_filter( 'gpeb_selected_user_filters', 'my_custom_function' );

Filter the selected user filters for Entries blocks querying entries from a specific form.

add_filter( 'gpeb_selected_user_filters_FORMID', 'my_custom_function' );

Parameters

  • filters array

    The selected user filters.

  • form_id int

    The form ID that the Entries block is querying.

Examples

Set default values for user-facing filters.

add_filter( 'gpeb_selected_user_filters', function( $filters, $form_id ) {
	$default_values = array(
		// Field/Input ID => Default Value
		1 => 'Second Choice'
	);

	$filters = array();

	foreach ( $default_values as $input_id => $default_value ) {
		$filters[ $input_id ] = rgars( $_GET, 'filters/' . $input_id, $default_value );
	}

	return $filters;
}, 10, 2 );

Since

This filter is available since Gravity Forms Entry Blocks 1.0-beta-1.3.