5R - Wordpress Search

Wordpress Search Functionality

Wordpress will look through its database and return results that are the most relevant to the search query. Wordpress will prioritize any matches within the post title, followed by matches within the post content.

More specifically, Wordpress returns matching posts in the following order:

  1. Titles with full sentence matches
  2. Titles that contain all search terms
  3. Titles that contain some search terms
  4. Content with full sentence matches

Role of the URI

For every search query, Wordpress understands the URI that is created from that query. This URI then gets converted into a more user-friendly URL that is based on the permalink settings.

Showing the Current/Active Search Term

get_search_query() is the function that retrieves the text that is inside the query and helps display it on the search bar.

Summary

A functioning search feature that displays the search terms and a user-friendly URL allows for a more positive user experience.