【发布时间】:2017-10-22 05:45:07
【问题描述】:
我在我的 wp 网站中使用此 php filter 搜索框。
我知道这是错误的,因为过滤器只显示最后一个查询,我如何以两种查询的工作方式编写代码?
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
$query->set('post_type', 'course');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
谢谢。
【问题讨论】:
标签: php jquery wordpress filter