Created
January 13, 2022 21:30
-
-
Save zackkatz/cd247e65b346b9d014f80220673f0088 to your computer and use it in GitHub Desktop.
GravityView - Change the default <select> option value
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 | |
/** | |
* Modify the text for the default option in a select (multi or single dropdown) | |
* | |
* @param string $default_option Default: `—` (—) | |
* @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