在 WordPress 中不显示多词搜索的搜索结果 [英] Search results not displaying for multiple word search in WordPress

查看:53
本文介绍了在 WordPress 中不显示多词搜索的搜索结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我自定义了一个主题,但在使用多字查询的搜索结果方面遇到了一些问题.网站位于 www.abetterworldbydesign.com

I've customized a theme and am having some problems with search results using multiple-word queries. Site is live at www.abetterworldbydesign.com

搜索单个词按预期工作.

搜索多个应该返回结果的词却显示空白结果.>

下面的 searchform.php 代码.

Searching for multiple words that should have returned results shows blank results.

Code for searchform.php below.

</表单>

<form id="searchform" name="searchform" method="get" action="<?php echo home_url(); ?>"> <div> <input type="text" id="s" name="s" /> <input type="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'richwp' ); ?>" /> </div> </form>

我在 search.php 中用于初始化 WP_Query 的代码完全遵循代码中列出的代码.pastebin 上的search.php 的完整代码.

My code in search.php for initializing WP_Query follows exactly the code listed in the codex. Full code for search.php on pastebin.

推荐答案

我猜你需要解码你从查询字符串中提取的搜索词,像这样:$search_query[$query_split[0]]= urldecode($query_split[1]).虽然,您可能只使用 Wordpress 的 get_query_var 函数而不是所有这些代码.

I would guess you need to decode the search term you are extracting from the query string, like so: $search_query[$query_split[0]] = urldecode($query_split[1]). Although, you could probably just use Wordpress's get_query_var function instead of all that code.

这篇关于在 WordPress 中不显示多词搜索的搜索结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆