#17320 closed enhancement (fixed)
has_post_format() should accept an array
Reported by: | janfabry | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | 3.2 |
Component: | Taxonomy | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
has_category()
, has_tag()
, and has_term()
accept an array as the first argument and return true
if the post has any of the given terms. has_post_format()
also uses has_term()
in the background, but it calls sanitize_key()
and adds 'post-format-'
to the passed format, which will fail when you pass an array.
For consistency, it would be better if has_post_format()
would also accept an array.
Attachments (3)
Change History (14)
#5
@
11 years ago
Refreshed the patch to match recent updates to Core and updated to remove unnecessary unset()
s.
In addition, the code will now just sanitize and prefix the array (or single string) and pass the array directly to has_term()
(which already accepted arrays to begin with.
#7
@
11 years ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 24817:
Note: See
TracTickets for help on using
tickets.
Catch arrays, check for non-string values, add prefix & send to has_term()