News WordPress

WordPress Search Improvements in 3.7

Updated

Written by

Dave Warfel

Reading Time

2 minutes

If you buy something from one of our links, we may earn a commission.

With the release of version 3.7, WordPress search has taken on quite a few improvements. Gone are the days of sorting results in chronological order, exact keyword matches & so on. WordPress search has finally put relevance ahead of publish date, and included several new filters for developers to further expand the search experience with plugins. Let’s take a look at what’s changed.

Search Results Ordered By Relevance

WordPress search results are now ordered by relevance (date is still used as a secondary sorting parameter, but relevance takes precedence). According to this changeset on WordPress Trac, here’s how the new ordering logic works:

  1. Full sentence matches in post titles
  2. All search terms in post titles
  3. Any search terms in post titles
  4. Full sentence matches in post content

Consider each of these bullet points as a section. The search results in each section will be ordered by date (independently of the other sections). So… relevance first, date second.

WordPress Search Filters & Functions

A couple new filters have been added to WordPress core, allowing developers to further expand WordPress search. These filters have not been documented yet, but we’ll explain them below as best we can. For a full understanding of each filter, search for them on the WordPress Trac.

  • __return_empty_string() – a function to return an empty string, for filters
  • wp_search_stopwords – filters stop words ignored in WHERE
  • posts_search_orderby – filters the ORDER BY when ordering search results

How will the new WordPress search change the way you develop sites? Are you more likely to use it now that it sorts by relevance first? Working on new plugins (or plugin updates) based on these filters?

Dave Warfel

LinkedIn  •  X (Twitter)Dave has been working with WordPress since 2011. He's built 100s of client sites and almost a dozen of his own. He's tested almost every plugin you can think of, hosted with at least 10 different companies, and gone down every SEO rabbit hole you can imagine. When's he's not tinkering with new software, you'll find him in the mountains of Colorado, trail running, summiting peaks, and rippin' downhills on his mountain bike. 🏔️🏃🚴🤸

Leave a Comment