WordPress 插件开发 如何一次性输入多个标签Tags搜索文章内容?

来源: 柚子科技、WordPress 主题、WordPress插件    日期: 2022-9-12        作者: WordPress主题themes插件plugins开发定制    阅读数: 5

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' ) ) );

腾讯云限时秒杀【点击购买】

搬瓦工,CN2高速线路,1GB带宽,电信联通优化KVM,延迟低,速度快,建站稳定,搬瓦工BandwagonHost VPS优惠码BWH26FXH3HIQ,支持<支付宝> 【点击购买】!

Vultr$3.5日本节点,512M内存/500G流量/1G带宽,电信联通优化,延迟低,速度快【点击购买】!

阿里云香港、新加坡VPS/1核/1G/25G SSD/1T流量/30M带宽/年付¥288【点击购买】

链接到文章: https://uziwp.com/14522.html

评论已关闭