Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaehlers/a070e57a09c42a3b61e9d95921457fd8 to your computer and use it in GitHub Desktop.
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.
<?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