diff --git a/src/includes/class-wordlift-sanitizer.php b/src/includes/class-wordlift-sanitizer.php index 6954274eb..b068b34f6 100644 --- a/src/includes/class-wordlift-sanitizer.php +++ b/src/includes/class-wordlift-sanitizer.php @@ -17,8 +17,13 @@ public static function sanitize_url( $value ) { // // see also http://stackoverflow.com/questions/2137080/php-filter-var-filter-validate-url - if ( $value !== null && '' !== $value ) { - return $value; + if ( ! is_string( $value ) ) { + return null; + } + + $trimmed_value = trim( $value ); + if ( '' !== $trimmed_value ) { + return $trimmed_value; } return null;