Good morning all,
Could anyone tell me if it's possible to include wildcards in WP_Query, for example: category=news*
Also is it possible to have exclusions similar to this
category_exclude=notnews*
Thanks in advance
Mike
Good morning all,
Could anyone tell me if it's possible to include wildcards in WP_Query, for example: category=news*
Also is it possible to have exclusions similar to this
category_exclude=notnews*
Thanks in advance
Mike
No. Wildcards of that sort don't work, and there's no "category_exclude" parameter to begin with.
You can use category__not_in for queries though, like so:
// this excludes categories with ID's of 1, 2, and 3
query_posts(array(
'category__not_in' => array(1,2,3),
));of that sort? is there another way? sorry the ID's could be anything
It is possible to directly alter the MySql query string via the posts_* filters. You really need to have a good grip on MySql syntax though.
Or could build an array of the category IDs you don't want with Function_Reference/get_categories, then use the format Otto suggested.
but users will be adding categories later
apljdi sounds like the best idea so far
This topic has been closed to new replies.