WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#48626 closed defect (bug) (wontfix)

Twenty Twenty: Remove unused function argument

Reported by: manikmist09 Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.3
Component: Bundled Theme Keywords: has-patch close
Focuses: Cc:

Description

function twentytwenty_edit_post_link accepts a param $text but that never been used instead hardcoded with translatable string. So I think the argument should not be there.

Attachments (1)

48626.patch (1.0 KB) - added by manikmist09 2 years ago.

Download all attachments as: .zip

Change History (5)

@manikmist09
2 years ago

#1 follow-ups: @nielslange
2 years ago

  • Summary changed from Remove unused function argument to Twenty Twenty: Remove unused function argument

@manikmist09 The Twenty Twenty theme uses the filter add_filter( 'edit_post_link', 'twentytwenty_edit_post_link', 10, 3 );. Removing $text from twentytwenty_edit_post_link( $link, $post_id, $text ) would lead to the fact that only the translation can be controlled but not the logic, in case a developer wants to allow additional HTML elements and/or attributes.

@Anlino and @williampatton Please correct me if I'm wrong.

#2 in reply to: ↑ 1 @manikmist09
2 years ago

@nielslange, in that case, I think developer can remove the filter and add their own

#3 in reply to: ↑ 1 @williampatton
2 years ago

Replying to nielslange:

@manikmist09 The Twenty Twenty theme uses the filter add_filter( 'edit_post_link', 'twentytwenty_edit_post_link', 10, 3 );. Removing $text from twentytwenty_edit_post_link( $link, $post_id, $text ) would lead to the fact that only the translation can be controlled but not the logic, in case a developer wants to allow additional HTML elements and/or attributes.

@Anlino and @williampatton Please correct me if I'm wrong.

This is correct, it is passed so that the it matches the signature of the apply_filters call here: https://core.trac.wordpress.org/browser/tags/5.3/src/wp-includes/link-template.php#L1395

There are alternative ways to handle this if we were to not pass this however I prefer we stay on the side of not adjusting any signatures at this point, especially when they are 1:1 matches with the caller. I am inclined to add a wontfix here but will wait to see if others have different thoughts.

#4 @ianbelanger
2 years ago

  • Focuses template removed
  • Keywords close added
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.