Add features to get_posts: select from multiple categories, or exclude categories
|Reported by:||johnjosephbachir||Owned by:|
This patch adds two features to get_posts(), while maintain backward compatibility with all previous invocations:
- The category variable may be a comma-separated list, specifying selection of posts from multiple categories.
get_posts('numberposts=5&category=1,5,6'); // get the 5 most recent posts from categories 1,5, and 6 (singular still works as before)
- The query may be inverted, so that the results are from any categories BUT the ones specified.
get_posts('numberposts=5&category=3,4&category_exclude=1'); // get the 5 most recent posts from all categories other than categories 3 and 4 (singular also works)
I haven't thoroughly tested this code, it's more for discussion purposes at this point. But I'm fairly confident that it's a complete solution.
(btw-- there is no 2.2.3 yet in the trac version menu)
Change History (8)
- Keywords needs-patch added; has-patch removed
- Milestone changed from 2.9 to Future Release
- Priority changed from normal to low
- Severity changed from normal to minor