Opened 10 years ago
Closed 10 years ago
#34245 closed enhancement (fixed)
Make the $taxonomy parameter in get_term_field() optional
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.4 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Taxonomy | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
Description (last modified by )
Following up on making the $taxonomy parameter in get_term() optional, we should also make it optional in get_term_field().
Patch attached with tests.
Attachments (4)
Change History (12)
#3
@
10 years ago
34245.2.diff also makes $term accept both a term ID and WP_Term object, and adds tests. (I really dig being able to use get_term_field() in "shorthand" without having to supply a taxonomy, btw).
#4
@
10 years ago
- Owner set to boonebgorges
- Status changed from new to reviewing
@boonebgorges Might giving this a once over?
Obviously there's a lot of missing tests for get_term_field() just generally, but is there anything I didn't cover for this particular set of changes?
#5
@
10 years ago
DrewAPicture - This change looks mostly good. Two small suggestions:
- Since you're modifying the final line of the function anyway, may as well fix the spacing inside the parens :)
- I'd add a test to show what happens when the value of
$taxonomydoesn't match the actual taxonomy of$term. This should be the same before and after the patch - aninvalid_termWP_Errorobject - but the code path is a bit different, in a way that's relevant to the change you're making here.
#6
@
10 years ago
@boonebgorges: Addressed your feedback in 34245.3.diff and added two tests, one each for the two WP_Error codes that might be returned via get_term().
$termshould accept an ID or an object