Make WordPress Core

#63732 closed task (blessed) (fixed)

Observation on Unused Global Variables in WordPress Core PHP Files

Reported by: viralsampat Owned by: johnjamesjacoby
Priority: normal Milestone: 6.9
Component: General Version: 6.7
Severity: normal Keywords: has-patch
Cc: Focuses: docs

Description

Hello Team,

I have reviewed the WordPress core PHP files and noticed that some global variables are referenced in the comments but are not explicitly defined in the code itself.

So, I think that if these variables are not being used anywhere, they should be removed from the list to avoid confusion and keep the codebase clean.

Files:


wp-admin/includes/plugin.php
wp-includes/rss.php
wp-includes/update.php

Please review it and share your feedback.

Thanks,

Attachments (1)

63732.patch​ (1.8 KB ) - added by viralsampat 15 months ago.
I have checked above mentioned issue and resolved it. Here, I have added my patch.

Download all attachments as: .zip

Change History (5)

@viralsampat
15 months ago

I have checked above mentioned issue and resolved it. Here, I have added my patch.

#1 @johnjamesjacoby
15 months ago

  • Keywords needs-testing dev-feedback 2nd-opinion removed
  • Milestone Awaiting Review → 6.9
  • Owner set to johnjamesjacoby
  • Status new → assigned
  • Type defect (bug) → task (blessed)

Both wp-admin/includes/plugin.php and wp-includes/rss.php look OK to me.

wp-includes/update.php uses wp_get_wp_version() since r58813, so some references to the $wp_version global could be removed.

#2 @johnjamesjacoby
15 months ago

I have checked above mentioned issue and resolved it. Here, I have added my patch.

@viralsampat $GLOBALS['wp_version'] is used in plugin.php and rss.php so those should stay.

#3 @johnjamesjacoby
15 months ago

  • Version → 6.7

#4 @johnjamesjacoby
15 months ago

  • Resolution → fixed
  • Status assigned → closed

In 60493:

Docs: remove global references to $wp_version that are no longer accurate.

This commit cleans up a few global $wp_version doc-block entries for functions that switched to using wp_get_wp_version() in 6.7.

Follow up to [58848], [59192].

Props viralsampat.

Fixes #63732.

Note: See TracTickets for help on using tickets.