mirror of
git://develop.git.wordpress.org/
synced 2025-03-20 12:00:03 +01:00
General: Memoize the return value in wp_get_wp_version()
.
This aims to optimize performance by saving the return value to a static variable, so that the `version.php` file is not unnecessarily required on each function call. Follow-up to [58813]. Props Cybr, debarghyabanerjee, mukesh27. Fixes #61782. See #61627. git-svn-id: https://develop.svn.wordpress.org/trunk@58827 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3977e6281d
commit
883d9b6731
@ -8819,7 +8819,11 @@ function clean_dirsize_cache( $path ) {
|
||||
* @return string The current WordPress version.
|
||||
*/
|
||||
function wp_get_wp_version() {
|
||||
require ABSPATH . WPINC . '/version.php';
|
||||
static $wp_version;
|
||||
|
||||
if ( ! isset( $wp_version ) ) {
|
||||
require ABSPATH . WPINC . '/version.php';
|
||||
}
|
||||
|
||||
return $wp_version;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user