Created
September 30, 2015 04:02
-
-
Save designbuildtest/77cc1fd50fb9409b11e6 to your computer and use it in GitHub Desktop.
Customizer YES/NO choices
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 | |
// Sanitize YES/NO choice. | |
function dbt_yes_no_choices() { | |
return apply_filters( 'dbt_yes_no_choices', array( | |
'no' => __( 'No' ), | |
'yes' => __( 'Yes' ), | |
) ); | |
} | |
function dbt_sanitize_yes_no_choice( $value ) { | |
$choices = dbt_yes_no_choices(); | |
if ( ! array_key_exists( $value, $choices ) ) { | |
$value = 'no'; | |
} | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment