WordPress 搜索结果奇怪?
我正在努力处理我的 WordPress 主题的搜索结果。我添加了一个 ajax 支持的搜索,如果没有启用 javascript,则可以回退到单个页面。基本上我的 search.php 询问是否设置了某个 post 参数,如果设置了,则仅返回结果。否则整个网站将被退回。
但搜索结果却很奇怪!通常会发现帖子不包含与搜索词相关的任何内容,甚至像 sdfsdf 这样的转储搜索有时也会返回结果。这里出了什么问题?
似乎找到了搜索词,因为我可以使用 get_search_query();将其打印出来。以前有其他人遇到过这种情况吗?
I'm struggling with the search results my wordpress theme. I've added a ajax powered search with fallback to a single page, if no javascript is enabled. Basically my search.php asks if a certain post parameter is set, and if yes, only the results are returned. Else the whole site will be returned.
But the search delivers really strange results! Often post are found, which doesn't contain anything related to the search term and even dump searches like sdfsdf will return sometime a result. What is going wrong here?
The searchterm seems to be found, as I can use get_search_query(); to print it out. Has anybody else encountered this before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
搜索可能是在所有内容(可见和不可见)中寻找搜索词。尝试重复您认为不正确的搜索之一并查看页面源代码(在大多数浏览器中按 ctrl+u),然后查找(ctrl+f)搜索词并查看它是否出现在链接或文件名中。
The search is probably looking for the search term in all of the content, visible and non-visible. Try repeating one of the searches that looked incorrect to you and view the page source (ctrl+u in most browsers), then find (ctrl+f) the search term and see if it turns up in a link or file name.