Created
December 22, 2017 05:27
-
-
Save techjewel/8613d2a08cd0ee76011689758a150f59 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
function ninjaSanitizeTextOrArray( $array_or_string ) { | |
if ( is_string( $array_or_string ) ) { | |
$array_or_string = sanitize_text_field( $array_or_string ); | |
} elseif ( is_array( $array_or_string ) ) { | |
foreach ( $array_or_string as $key => &$value ) { | |
if ( is_array( $value ) ) { | |
$value = ninjaSanitizeTextOrArray( $value ); | |
} else { | |
$value = ninjaSanitizeTextOrArray( $value ); | |
} | |
} | |
} | |
return $array_or_string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment