Created
January 7, 2022 22:16
-
-
Save rafaehlers/a070e57a09c42a3b61e9d95921457fd8 to your computer and use it in GitHub Desktop.
If there's an "Other" choice on a dropdown field inside a Search Bar, remove it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // DO NOT COPY THIS LINE | |
add_action( 'gravityview_search_widget_fields_before', 'gv_modify_search_fields', 10); | |
function gv_modify_search_fields( $search_obj ){ | |
foreach( $search_obj->search_fields as $key => &$search_field ) { | |
if ( $search_field['type'] === 'select' ){ | |
foreach ( $search_field['choices'] as $key => $value ){ | |
if ( $value['text'] === 'Maybe' ){ | |
unset ( $search_field['choices'][$key] ); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment