Skip to content

Commit 00b3b63

Browse files
Coding Standards: Simplify a conditional in get_url_in_content().
As there's an `is_string()` check already, `! empty( $href )` can be simplified to a string comparison, as the other variable types that are checked in `empty()` won't appear. `empty()` also returns `false` for the string `"0"` which would however be a valid (relative) URL and thus should be detectable by the function. Follow-up to [60665]. Props TobiasBg. Fixes #63694. git-svn-id: https://develop.svn.wordpress.org/trunk@60726 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f57cf3d commit 00b3b63

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wp-includes/formatting.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5989,7 +5989,7 @@ function get_url_in_content( $content ) {
59895989
$processor = new WP_HTML_Tag_Processor( $content );
59905990
while ( $processor->next_tag( 'A' ) ) {
59915991
$href = $processor->get_attribute( 'href' );
5992-
if ( is_string( $href ) && ! empty( $href ) ) {
5992+
if ( is_string( $href ) && '' !== $href ) {
59935993
return sanitize_url( $href );
59945994
}
59955995
}

0 commit comments

Comments
 (0)