Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Created January 13, 2022 21:30
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 zackkatz/cd247e65b346b9d014f80220673f0088 to your computer and use it in GitHub Desktop.
Save zackkatz/cd247e65b346b9d014f80220673f0088 to your computer and use it in GitHub Desktop.
GravityView - Change the default <select> option value
<?php
/**
* Modify the text for the default option in a select (multi or single dropdown)
*
* @param string $default_option Default: `&mdash;` (—)
* @param string $field_type Field type: "select" or "multiselect"
*
* @return string
*/
add_filter( 'gravityview/extension/search/select_default', function( $default, $select_type = 'select' ) {
if( 'select' === $select_type ) {
return '-- Select --';
}
return '-- Select One or More --';
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment