General: Avoid early initialization of variable in get_bloginfo().

This is a very minor, yet simple performance optimization in a commonly called function, avoiding unnecessary initialization of the `$url` variable when it may not be needed. The conditional is simple enough to not use a variable altogether.

Props Cybr, swissspidy.
Fixes #59450.


git-svn-id: https://develop.svn.wordpress.org/trunk@57170 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz 2023-12-07 22:55:28 +00:00
parent 8035bdaec0
commit d859cbe790

View File

@ -906,17 +906,12 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
break;
}
$url = true;
if ( ! str_contains( $show, 'url' )
&& ! str_contains( $show, 'directory' )
&& ! str_contains( $show, 'home' )
) {
$url = false;
}
if ( 'display' === $filter ) {
if ( $url ) {
if (
str_contains( $show, 'url' )
|| str_contains( $show, 'directory' )
|| str_contains( $show, 'home' )
) {
/**
* Filters the URL returned by get_bloginfo().
*