From 7926dbb4d5392c870ccbc3ec6019c002feed904c Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Thu, 7 Dec 2023 22:57:28 +0000 Subject: [PATCH] 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 --- wp-includes/general-template.php | 15 +++++---------- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 28fb3394d2..ddc34db34f 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -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(). * diff --git a/wp-includes/version.php b/wp-includes/version.php index 107b4d32ae..d5bfe52113 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @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.