Opened 12 months ago
Last modified 7 months ago
#59297 new defect (bug)
Remove unused variables
Reported by: | upadalavipul | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | coding-standards | Cc: |
Description
I have reviewed the code and found some of the variables are defined but they do not use in the below files. Please check the below files:
Files:
- wp-admin/includes/class-wp-privacy-policy-content.php
- wp-admin/includes/post.php
Attachments (7)
Change History (8)
@
12 months ago
I have checked above mentioned issue and founds another file. Here, I have added its patch.
@
12 months ago
I have checked above mentioned issue and founds another files. Here, I have added its patch.
@
10 months ago
I have checked above mentioned issue and founds few files. Here, I have added its patch.
@
10 months ago
I have checked above mentioned issue and founds few files. Here, I have added its patch.
#1
@
7 months ago
- Keywords has-patch added
- Summary changed from Remove Unused variables in the wp-admin folder. to Remove unused variables
When uploading multiple patches to one ticket, please use the attachment's Description field to identify what makes it different from the other patches.
59297.patch changes two files:
- It removes
$content
,$class
,$meta
fromprivacy_policy_guide()
. These variables might not have any value after [50161], unless they still help with the deprecatedwp_get_default_privacy_policy_content
filter. - The same patch also removes
$hidden_inputs
fromthe_block_editor_meta_box_post_form_hidden_fields()
, which was added in #45283 / [44241]. Could this have some use in theblock_editor_meta_box_hidden_fields
hook?
59297.2.patch removes the $post_ID
variable from wp-admin/edit-form-advanced.php
and wp-admin/post-new.php
(note: other $post_ID
variables had been updated to $post_id
in #57692, but not the global).
59297.3.patch proposes removing $compat
and $submenu
from wp-admin/user/menu.php
. However, both are used in wp-admin/includes/menu.php
.
59297.4.patch proposes removing $parent_file
, $title
and/or $pagenum
variables from three network admin pages.
- The
$title
and$parent_file
variables are necessary for use inwp-admin/admin-header.php
(#53729). - The
$pagenum
variable was added tonetwork/sites.php
in [17274], but then [17900] removed where it was used. Also, [27499] removed$pagenum
fromwp-admin/includes/theme-install.php
. If it does not belong innetwork/sites.php
anymore, then it probably could be deleted from four files:
- wp-admin/network/sites.php, line 18
- wp-admin/network/themes.php, line 18
- wp-admin/plugins.php, line 17
- wp-admin/upload.php, line 252
59297.5.patch edits multiple files in the wp-includes
directory:
- It removes
$more
fromwp-includes/feed-atom.php
but not the other feeds (feed-rdf.php
,feed-rss.php
andfeed-rss2.php
). If one file does not use the variable, the other three might not either. - In
wp-includes/link-template.php
, the patch removes$tax
fromedit_term_link()
. Changeset 38698 replaced$tax
in that function, though the similar functionget_edit_term_link()
still uses the variable. Is it worth adding a! $tax
condition inedit_term_link()
too, or would removing the$tax
variable be preferable? - The
$wpdb
global documentation can be removed from theget_blog_id_from_url()
docblock. [37620] removed the global from that function. - In
wp-includes/ms-load.php
, the patch proposes removing$blog_id
fromms_load_current_site_and_network()
.
59297.6.patch suggests removing $AudioChunkStreamNum
from the getID3 RIFF module, but that should be reported on the external library's GitHub repository. The patch also deletes the $unapproved_ids
and $unapproved_emails
, which were already removed by [55559].
59297.7.patch has multiple changes:
- It removes
$blog_id
,$_wp_switched_stack
and$switched
fromwp-includes/ms-settings.php
. As noted in ticket:59420#comment:2, the$_wp_switched_stack
and$switched
globals are necessary. - I am not sure about whether
$blog_id
can be removed fromwp-includes/ms-settings.php
. - The
class-wp-rest-server.php
change was already committed in [56645].
Patches from #59420
59420.5.patch and 59420.6.patch remove $returnType
and $method
variables from IXR_IntrospectionServer::call()
(the IXR library is "adopted" - see comment:2:ticket:48267). Note that a $method
variable is used within other parts of the class, though I am not sure it is the same variable.
59420.8.patch proposes changes to two files:
- The
privacy_policy_guide()
revisions are already part of 59297.patch. - The patch removes
$network_exists
from inwp-admin/includes/schema.php
. The variable was added in [41348].
59420.10.patch proposes multiple changes:
- The
$parent_file
is necessary to keep in bothwp-admin/network/settings.php
andwp-admin/network/sites.php
. - The patch also removes
$is_main_site
fromwp-admin/network/site-users.php
. One significant commit related to$is_main_site
is [15903], when the variable was moved fromnetwork/sites.php
. - The
$pagenum
might not be necessary inwp-admin/network/sites.php
, but see the note above about the possibility of removing it from other files too.
patch added