WordPress插件开发中,如何实现在前端页面如何同时搜索多个标签?
类似:?tag=tag1+tag2
下面我们给出代码示例:
<?php
/** 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' ) ) );