Filter Block: Convert Checkboxes to Single Line Text

Rather than displaying 50 checkboxes when using a Checkbox field in the Filter block, allow Entry Blocks to convert the Checkbox field to a Single Line Text field in the Filter block context. Users can then search for any checkbox value.

Code

Filename: gpeb-filter-block-convert-checkbox-field-to-text-field.php

<?php
/**
 * Gravity Perks // Entry Blocks // Filter Block: Convert Checkboxes to Single Line Text
 * https://gravitywiz.com/documentation/gravity-forms-entry-blocks/
 *
 * Rather than displaying 50 checkboxes when using a Checkbox field in the Filter block, allow Entry Blocks
 * to convert the Checkbox field to a Single Line Text field in the Filter block context. Users can then
 * search for any checkbox value.
 */
add_filter( 'gpeb_filter_fields_preserve_type', function( $types ) {
	$types = array_diff( $types, array( 'checkbox' ) );
	return $types;
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.