I was recently working on a site for a client (yes, I build websites too) and one aspect of the website included the ability to use the site’s search function to search for a competitor’s product code and have the site display the equivalent product offered by my client.
In order to implement this function, I decided to insert the competitor’s codes as custom fields to each product’s post. However, therein lay a problem; WordPress’ search function doesn’t search custom fields in posts.
In fact, this is just one of a whole host of restrictions in the WordPress search function. Here’s a few more:
- Results displayed by newest first, rather than best match.
- Cannot search comments, categories, tags, shortcode content or excerpts.
- Cannot highlight the search term for easy recognition.
- Corrections to spelling mistakes not offered (did you mean…?).
- Restrict specific pages, posts or categories from appearing in results.
- Track search queries for better understanding of user behaviour.
- Cache search results for improved performance.
In fact, I’m surprised that a revamp of the WordPress search has not been included recent development cycles. Maybe it will be included for WordPress 3.4…?
At any rate, despite WordPress’ shortcomings, there is an excellent plugin that will help solve most of your gripes with the standard WordPress search function.
Relevanssi‘s motto is “WordPress Search Done Right” and they mean it too. There’s more features than you can shake a stick at, which makes this comprehensive plugin the perfect candidate for anyone who wants or needs a little more than WordPress’ bare bones search gives you.
The out-of-the-box setup is pretty decent, touting features like using the AND operator as stand (must match all search terms), but falling back to the OR operator (match any term) if there are no results using the AND operator.
Among the other features are the ability to restrict searches to certain categories or tags (or exclude certain ones instead), custom excerpts in your search results (length of snippet set by you), highlighting the search term in search results and even the entire post, once it’s opened from the search results and a user-defined set of stopwords (words to ignore when searched for).
Whatever reason you’re looking for a little more from the WordPress search function, chances are that Relevanssi has the answer you’re looking for. They also have a premium edition, which includes even more specialised options. Check out the feature comparison here.
Have you ever felt hampered by the standard WordPress search? Do you agree that it’s about time for an upgrade? What feature would you like to see included?