Opened 19 years ago
Closed 17 years ago
#1625 closed defect (bug) (invalid)
Multiple category support and category negation for get_posts()
Reported by: | markjaquith | Owned by: | drac |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 1.6 |
Component: | Administration | Keywords: | has-patch review 2nd-opinion |
Focuses: | Cc: |
Description
Would be really nice to have multiple category support and category negation support for the get_posts() function.
suggested by kapowaz
Attachments (1)
Change History (8)
Note: See
TracTickets for help on using
tickets.
patch attached.
maintains compatibility with existing syntax for get_posts; but any category can now be negated by prefixing with $negation_char (I defined it as , but it can be changed easily).
get_posts(numberposts=10&offset=0&category=3')
multiple categories are also supported with the parse_str array syntax
get_posts(numberposts=10&offset=0&category[]=1+2+3')
Any category/categories in the array syntax can be negated individually.
get_posts(numberposts=10&offset=0&category[]=1+2+3) asks for 1, 3 and negates 2. Can't think of a use for this yet though.
Didn't want to change the function signature, but I would like to resubmit this patch with an additional negateall parameter. False by default, this would allow a list of category ids to be marked as negated without prefixing each cat_id with the $negation_char. comments ?