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.

Built from https://develop.svn.wordpress.org/trunk@57170


git-svn-id: http://core.svn.wordpress.org/trunk@56681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Felix Arntz 2023-12-07 22:57:28 +00:00
parent f402ce754d
commit 7926dbb4d5
2 changed files with 6 additions and 11 deletions

View File

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

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-alpha-57169'; $wp_version = '6.5-alpha-57170';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.