Created
May 1, 2018 14:03
-
-
Save kjohnson/a005a26fecfe896f856a90cd4500ee5f to your computer and use it in GitHub Desktop.
Set the default checked option for a select list field.
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 | |
add_filter( 'ninja_forms_render_options', 'my_ninja_forms_render_options', 10, 2 ); | |
function my_ninja_forms_render_options( $options, $settings ){ | |
foreach( $options as &$option ){ | |
if( 'three' == $option[ 'value' ] ){ | |
$option[ 'selected' ] = 1; | |
} | |
} | |
return $options; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment