我目前正在实现一个搜索功能 search the post from wordpress

我想 search the post by Tag , by title and return it as JSON

我发现了一个以JSON(JSON API)生成结果的插件

http://wordpress.org/plugins/json-api/other_notes/#2.1.-Core-controller-methods

在该插件中,有一个get_posts函数可以返回支持WP_query参数的查询

我试过这样的查询

http://MyWordpressSite.com/?json=get_posts&status=published&orderby=date&order=DESC&lang=en&s=eng&tag=eng&cat=9,10,14,15

其中&s =是要搜索的关键字,而&tag =是要搜索的标记

但是,有两个问题

从官方网站上看,它是州搜索关键字,但不仅限于 Headers

  • 似乎条件是标签"AND"关键字匹配,但我想要实现的是标签"OR"关键字匹配

http://codex.wordpress.org/Function_Reference/get_posts

所以,总而言之,目标是通过标签搜索帖子,按 Headers 将其返回为JSON(实际上是通过JSON调用php),无论是否使用插件都无关紧要,任何实现目标的方式都是受欢迎的 . 谢谢你的帮助