#57371 closed enhancement (fixed)
Twenty Twenty: Remove Unused function parameter and variable.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | has-patch dev-feedback |
Focuses: | coding-standards | Cc: |
Description
I have reviewed twenty-twenty theme codes and I found some of the function parameters and variables Unused. So I have to remove it from the below files.
Files:
- twentytwenty/classes/class-twentytwenty-walker-page.php
- twentytwenty/inc/template-tags.php
Attachments (1)
Change History (10)
#1
@
2 years ago
- Component changed from General to Bundled Theme
- Keywords has-patch added
- Summary changed from Remove Unused function parameter and variable. to Twenty Twenty: Remove Unused function parameter and variable.
#2
follow-up:
↓ 6
@
22 months ago
- Focuses coding-standards added
- Keywords changes-requested added
- Milestone changed from Awaiting Review to 6.3
This ticket was mentioned in PR #4678 on WordPress/wordpress-develop by @sabernhardt.
20 months ago
#5
- Removes
$n
variable fromTwentyTwenty_Walker_Page
classstart_el()
- Removes last parameter from
twentytwenty_filter_wp_list_pages_item_classes()
andtwentytwenty_add_sub_toggles_to_main_menu()
Trac ticket: https://core.trac.wordpress.org/ticket/57371
#6
in reply to:
↑ 2
@
20 months ago
Replying to sabernhardt:
The global
$post
variable should stay. According to the setup_postdata documentation, "setup_postdata()
does not assign the global$post
variable so it’s important that you do this yourself."
I argue that if we already pass the post ID to the setup_postdata
function, then why do we need to use the global variable?
#7
@
20 months ago
- Keywords dev-feedback added; changes-requested removed
I removed the global, and the post's tag still appeared in the meta section as expected. If that variable is necessary or if we are unsure, I can revert that last change.
#8
@
20 months ago
- Owner set to audrasjb
- Resolution set to fixed
- Status changed from new to closed
In 56045:
@audrasjb commented on PR #4678:
20 months ago
#9
committed in https://core.trac.wordpress.org/changeset/56045
Not using the
$n
line break variable may have been a mistake, though removing the variable probably would be better than adding it to the markup now.The global
$post
variable should stay. According to the setup_postdata documentation, "setup_postdata()
does not assign the global$post
variable so it’s important that you do this yourself."When removing the last parameter from the
twentytwenty_filter_wp_list_pages_item_classes
andtwentytwenty_add_sub_toggles_to_main_menu
functions, also remove the parameter from those functions' documentation and decrease the count argument in the related filters. (See #57397)