#16464 closed defect (bug) (fixed)
get_term_by() returns WP_Error as well
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.1.1 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Warnings/Notices | Keywords: | |
Focuses: | Cc: |
Description
It's not documented, but get_term_by() can return WP_Error as well in case it fails.
Code that checks for the return value only against being not empty is doing short as WP_Error never is empty.
The result are most often undefined property warnings.
Attachments (2)
Change History (13)
#3
@
14 years ago
The second patch "corrects" the return value for the function get_term_by()
based on the information in the function's docblock comment (return false on error).
#6
@
14 years ago
- Keywords 3.2-early added
- Milestone changed from Awaiting Review to Future Release
- Version changed from 3.1 to 3.0
If that is indeed the only way for get_term_by() to return WP_Error (and that's what it looks like), then the fix looks good. They already needed to look for false anyway, so I'm fine with preventing the possibility of WP_Error being returned through get_term_by().
Note: See
TracTickets for help on using
tickets.
The related feature is: Advanced multi-taxonomy WP_Query()s (#12891)