Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php BP搜索项多个字段_Php_Html_Wordpress_Search_Buddypress - Fatal编程技术网

Php BP搜索项多个字段

Php BP搜索项多个字段,php,html,wordpress,search,buddypress,Php,Html,Wordpress,Search,Buddypress,正在尝试使用多个字段在我的博客中搜索成员 <?php if ( bp_has_members( "search_terms=Red Box" ) AND bp_has_members( "search_terms=Blue Box" )) : ?> <?php while ( bp_members() ) : bp_the_member(); ?> …html here <?php endwhile; ?> <?php endif; ?>

正在尝试使用多个字段在我的博客中搜索成员

<?php if ( bp_has_members( "search_terms=Red Box" ) AND bp_has_members( "search_terms=Blue Box" ))  : ?>
<?php while ( bp_members() ) : bp_the_member(); ?>

…html here

<?php endwhile; ?>
<?php endif; ?>

…这里是html
然而,如果我使用这段代码,结果只会显示“蓝盒”成员,而不会同时显示两者


有什么建议吗?

来自BuddyPress文档:

要搜索多个术语,请在每个术语之间留出空格。搜索基于“和”,而不是“或”。因此,只有同时选择/输入“贵宾犬”和“胡萝卜”的成员才会被返回


如果搜索词包含空格,这显然不起作用


请参阅文档,特别是
my\u custom\u ids()
示例。您可以使用类似的函数传入查询条件,运行SQL语句仅获取这些条件所适用的成员,然后返回一个类似于
include=1,2,5,6,7
的字符串,以仅获取这些用户ID。

谢谢,不过我已经看过文档,如果我有%20作为空格,则没有结果。我只是翻遍了代码,你最好编写一个自定义函数来返回用户ID,然后将其传递给
bp\u has\u members()
。这就是我遇到问题的地方,因为del;操作是通过选项标记和使用search_terms={$\u POST['category']}
<?php if ( bp_has_members( 'search_terms=poodles carrots' ) ) : ?>