【问题标题】:Multiple Tag Search WordPress多标签搜索WordPress
【发布时间】:2013-07-23 04:51:43
【问题描述】:

WordPress 3.5.2。 像

这样的老建筑
?tag=tag1+tag2

不再起作用了。我不知道为什么。 我有一个带有复选框的表格。以及按类别排序的标签。 所以我想搜索

tag1+tag2+tag3

在特定类别中。 怎么做? 我很累寻找解决方案:(

【问题讨论】:

    标签: wordpress search tags


    【解决方案1】:

    逗号分隔它们:

    /** posts with any of the following tags */   
    $query = new WP_Query( 'tag=bread,baking' );
    
    /** posts with all of the following tags */
    $query = new WP_Query( 'tag=bread+baking+recipe' );
    
    /** or alternatively */
    $query = new WP_Query( array( 'tag_slug__in' => array( 'bread', 'baking' ) ) );
    

    在此处记录:http://codex.wordpress.org/Class_Reference/WP_Query

    【讨论】:

      猜你喜欢
      • 2015-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-06
      • 2012-02-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多