Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 7 months ago

#35922 closed enhancement (fixed)

get_edit_term_link should not require $taxonomy

Reported by: nicdford's profile nicdford Owned by: boonebgorges's profile boonebgorges
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.4
Component: Taxonomy Keywords:
Focuses: Cc:

Description

Both get_term() and get_term_link() no longer require $taxonomy to work anymore and get_edit_term_link() should follow suit. It would be best to utilize the $term->taxonomy if one isn’t set.

Special thanks to @sc0ttkclark for helping me with my first ticket! :)

Attachments (1)

enhancement.35922.diff (1.5 KB) - added by nicdford 9 years ago.

Download all attachments as: .zip

Change History (11)

#1 @welcher
9 years ago

Welcome and thanks for the patch!

#2 @sc0ttkclark
9 years ago

Patch incoming :)

#3 @boonebgorges
9 years ago

  • Milestone changed from Awaiting Review to 4.5
  • Owner set to boonebgorges
  • Status changed from new to assigned

Thanks! Let's sneak this in.

Side note: when generating your patches, please set your editor config to use tabs rather than spaces :)

#4 @nicdford
9 years ago

Will do! Thanks @boonebgorges

#5 @boonebgorges
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 36646:

Make $taxonomy parameter optional in get_edit_term_link().

Props nicdford, sc0ttkclark.
Fixes #35922.

#6 @johnbillion
9 years ago

  • Version set to 4.4

#7 @swissspidy
9 years ago

@boonebgorges While working on #36224 I noticed that test_cap_check_should_use_correct_taxonomy_when_taxonomy_is_not_specified is not 100% correct / incomplete.

First, manage_terms is not a direct taxonomy property, but can only be passed as part of the capabilities array.
Second, get_edit_term_link() checks against edit_terms capability, not manage_terms.
Third, the wptests_tax_subscriber taxonomy isn't even used in the test.

I'd add a new test to check that the custom capabilities get respected when using get_edit_term_link().

#8 @boonebgorges
9 years ago

Yikes, you are right. Not sure what I was thinking.

#9 @boonebgorges
9 years ago

In 36986:

Fix test related to cap check in get_edit_term_link().

The test was introduced in [36646] was intended to demonstrate that the cap
check in get_edit_term_link() uses the custom capability from the correct
taxonomy when $taxonomy is not specified but must be inferred from the
provided term. However, the test was wrongly written in pretty much every way.
Antiprops boonebgorges.

Props swissspidy.
See #35922.

#10 @flixos90
7 months ago

In 58807:

Taxonomy: Ensure get_edit_term_link() produces the correct result when called without taxonomy.

This fixes an oversight missed in [36646].

Props debarghyabanerjee.
Fixes #61726.
See #35922.

Note: See TracTickets for help on using tickets.