Opened 5 years ago
Closed 5 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)
Change History (5)
#1
follow-ups:
↓ 2
↓ 3
@
5 years ago
- Summary changed from Remove unused function argument to Twenty Twenty: Remove unused function argument
#2
in reply to:
↑ 1
@
5 years ago
@nielslange, in that case, I think developer can remove the filter and add their own
#3
in reply to:
↑ 1
@
5 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
fromtwentytwenty_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.
@manikmist09 The Twenty Twenty theme uses the filter
add_filter( 'edit_post_link', 'twentytwenty_edit_post_link', 10, 3 );
. Removing$text
fromtwentytwenty_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.