Make WordPress Core


Ignore:
Timestamp:
10/03/2024 12:23:53 AM (19 months ago)
Author:
peterwilsoncc
Message:

General: Expand use of wp_get_wp_version().

Expands the use of wp_get_wp_version() to get an unmodified value of the current WordPress version in various locations in which it would be unhelpful if a plugin has modified the global $wp_version.

This includes:

  • Theme and plugin compatibility tests
  • During the upgrade process of WP Core
  • Debug and site health data reports of the current version
  • Version number display in the dashboard
  • Block theme export and caching utilities
  • The WPDB class

Props peterwilsoncc, hellofromtonya.
See #61627.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-theme-upgrader.php

    r57252 r59159  
    372372     * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
    373373     *
    374      * @global string $wp_version The WordPress version string.
    375      *
    376374     * @param string[] $themes Array of the theme slugs.
    377375     * @param array    $args {
     
    384382     */
    385383    public function bulk_upgrade( $themes, $args = array() ) {
    386         global $wp_version;
    387 
     384        $wp_version  = wp_get_wp_version();
    388385        $defaults    = array(
    389386            'clear_update_cache' => true,
     
    559556     *
    560557     * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
    561      * @global string             $wp_version    The WordPress version string.
    562558     *
    563559     * @param string $source The path to the downloaded package source.
     
    565561     */
    566562    public function check_package( $source ) {
    567         global $wp_filesystem, $wp_version;
    568 
     563        global $wp_filesystem;
     564
     565        $wp_version           = wp_get_wp_version();
    569566        $this->new_theme_data = array();
    570567
Note: See TracChangeset for help on using the changeset viewer.