重写/更改 WordPress 搜索机制
我一直在寻找一种改变 WordPress 搜索机制的方法。我的数据库有几个自定义表格,我想在搜索网站时考虑这些表格。另外,我不想实现 levenshtein 函数来提出诸如“您的意思是[另一个术语]吗?”之类的行。当有人犯拼写错误时。
是否有我可以实现或更改的钩子、操作或函数来允许这些类型的函数?非常感谢任何帮助。
亲切的问候,
雷德尔
I've been looking for a way to change the WordPress searching mechanism. My database has several custom tables, which I want to take into account when searching the site. Also, I wan't to implement a levenshtein function for coming up with lines like "Did you mean [another term]?" when somebody makes a spelling error.
Is there a hook, action or function I can implement or change to allow these kind of functions? Any help is greatly appreciated.
Kind regards,
Reinder
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 WordPress 搜索替换为您自己的搜索,方法是将您自己的搜索框替换为自定义搜索框,然后调用使用这些搜索之一的函数。这将允许您替换默认的 WordPress 搜索,而无需修改核心文件。
三个可能的选项是:
我必须为我自己的 WordPress 网站做类似的事情。我最初使用 MySQL 进行对抗,但后来我改用了 Sphinx。我在使用 MySQL 匹配时遇到了严重的速度问题,尽管当我切换到 Sphinx 时这些问题就消失了。
You could just replace the WordPress search with your own search, by replacing your own search box with a custom search box which then calls a function which uses one of these searches. This will allow you to replace the default wordpress search without modifying the core files.
Three possible options would be:
I had to do a similar thing for my own WordPress site. I originally went with MySQL match against, but I have since switched to Sphinx. I ran into serious speed issues using MySQL match against, although those problems vanished when I switched to Sphinx.