Opened 5 years ago
Closed 5 years ago
#50344 closed defect (bug) (fixed)
Update @return docs for get_tags() to reflect that WP_Error is a possible return value
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.5 | Priority: | low |
Severity: | minor | Version: | |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | docs | Cc: |
Description
get_tags()
, by virtue of its call to get_terms()
, has the potential to return a WP_Error
object (if a specified taxonomy does not exist).
Unlike the similar get_categories()
, get_tags()
does not check for an error and return an empty array if there is one, so a WP_Error
object can be returned by get_tags()
.
Patch attached.
Quick demonstration of return value:
$ wp eval "var_dump( get_tags( [ 'taxonomy' => 'xyz' ] ) );" object(WP_Error)#1621 (2) { ["errors"]=> array(1) { ["invalid_taxonomy"]=> array(1) { [0]=> string(17) "Invalid taxonomy." } } ["error_data"]=> array(0) { } }
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Patch mentioned in ticket.