WordPress Search

WordPress Search Functionality

The search bar is a feature in WordPress that allows users to search a WordPress site. The search result that the user places in will search page titles, content, image titles & captions, image alt text, as well as file names, to find a relevant match to your search query. If multiple posts come back with the search query present, WordPress will sort the results in reverse chronological order. Using the WordPress search will not return any comments, widgets, categories, tags, among a select few other things.

How Does the URI Impact Search?

While I couldn't find a concrete answer on how a URI impacts search functionality, from what I've seen and gathered, it seems that setting up a clean permalink structure allows the search in WordPress to easily find specific pages. For instance, a search of 'about' would lead to the about page better if the about page URI was simply: /about, rather than it being p=xyz? .

Showing the Current Term in the Search Field

There seems to be a couple different ways for having the search bar display the most recent search term. It can be done by making the search form sticky, preventing it from changing text when loading a different page, or it can be done by echoing out the search query by using {echo get_search_query(); }.

Summary

Overall, the search functionality in WordPress allows users to look through a site's content and find what they need, but it is limited to page titles and content, image titles, captions, and alt text, as well as file names. Having a straight-forward permalink structure makes it easier to find certain pages using the search functionality. The search query can remain in the search bar by making the field sticky, or by using some PHP to echo out 'get_search_query();'.