Rewrite/change WordPress search mechanism

2019-09-16 03:59发布

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

1条回答
淡お忘
2楼-- · 2019-09-16 04:31

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.

查看更多
登录 后发表回答