最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

sort - Filter posts under multiple categories?

programmeradmin3浏览0评论

How do I filter the posts by multiple categories? For example, if some of my posts are categorized under just apples and some as just oranges and some both, how would I filter the results to show only posts marked under both apples and oranges?

In other words, I don't want the results to list all posts under apples and all posts under oranges. I only want to show posts listed under both apples and oranges. Is there a way to do this?

How do I filter the posts by multiple categories? For example, if some of my posts are categorized under just apples and some as just oranges and some both, how would I filter the results to show only posts marked under both apples and oranges?

In other words, I don't want the results to list all posts under apples and all posts under oranges. I only want to show posts listed under both apples and oranges. Is there a way to do this?

Share Improve this question edited Nov 20, 2014 at 19:02 Pieter Goosen 55.4k23 gold badges115 silver badges210 bronze badges asked Apr 15, 2012 at 19:00 stevesteve 191 silver badge2 bronze badges 1
  • 1 Search inside multi-taxonomy-query. – kaiser Commented Apr 15, 2012 at 19:08
Add a comment  | 

1 Answer 1

Reset to default 7

Wordpress does this automatically if you do

http://yoursite/?cat=1+2 (where 1 and 2 is category ids)

OR

http://yoursite/?category_name=apples+oranges (where apples and oranges is the slugs)

OR something like

http://yoursite/category/apples+oranges

发布评论

评论列表(0)

  1. 暂无评论