Opened 3 years ago
Last modified 2 years ago
#59297 new defect (bug)
Remove unused variables
| Reported by: | upadalavipul | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | coding-standards |
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)
@
3 years ago
I have checked above mentioned issue and founds another file. Here, I have added its patch.
@
3 years ago
I have checked above mentioned issue and founds another files. Here, I have added its patch.
@
3 years ago
I have checked above mentioned issue and founds few files. Here, I have added its patch.
@
3 years ago
I have checked above mentioned issue and founds few files. Here, I have added its patch.
#1
@
2 years ago
- Keywords has-patch added
- Summary Remove Unused variables in the wp-admin folder. → 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,$metafromprivacy_policy_guide(). These variables might not have any value after [50161], unless they still help with the deprecatedwp_get_default_privacy_policy_contentfilter. - The same patch also removes
$hidden_inputsfromthe_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_fieldshook?
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
$titleand$parent_filevariables are necessary for use inwp-admin/admin-header.php(#53729). - The
$pagenumvariable was added tonetwork/sites.phpin [17274], but then [17900] removed where it was used. Also, [27499] removed$pagenumfromwp-admin/includes/theme-install.php. If it does not belong innetwork/sites.phpanymore, 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
$morefromwp-includes/feed-atom.phpbut not the other feeds (feed-rdf.php,feed-rss.phpandfeed-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$taxfromedit_term_link(). Changeset 38698 replaced$taxin that function, though the similar functionget_edit_term_link()still uses the variable. Is it worth adding a! $taxcondition inedit_term_link()too, or would removing the$taxvariable be preferable? - The
$wpdbglobal 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_idfromms_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_stackand$switchedfromwp-includes/ms-settings.php. As noted in ticket:59420#comment:2, the$_wp_switched_stackand$switchedglobals are necessary. - I am not sure about whether
$blog_idcan be removed fromwp-includes/ms-settings.php. - The
class-wp-rest-server.phpchange 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_existsfrom inwp-admin/includes/schema.php. The variable was added in [41348].
59420.10.patch proposes multiple changes:
- The
$parent_fileis necessary to keep in bothwp-admin/network/settings.phpandwp-admin/network/sites.php. - The patch also removes
$is_main_sitefromwp-admin/network/site-users.php. One significant commit related to$is_main_siteis [15903], when the variable was moved fromnetwork/sites.php. - The
$pagenummight not be necessary inwp-admin/network/sites.php, but see the note above about the possibility of removing it from other files too.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
patch added