05 Research and Documentation Wordpress Search

Link back to Main Page

Wordpress Search Functionality

The main functionality of Wordpress's search feature is what exactly it scans as it goes through the page of a website. The content it scans includes: Page titles, titles of media (images, videos, etc.), Alt text, file names, image captions, and text in paragraphs.

The Role of the URI

The search feature will try to prioritize any URI that matches any of the given options above, exactly as it was written in the query. Generally higher priority is given to titles that match both the URI and the query. It may also prioritize posts or pages more carefully based on the query given.

How to show the current/active search term in search form field

There is one function in particular that can aid in the process of showing the active search terms. get_search_query allows you to collect what was written into the search bar, and that same result can be echoed out somewhere on the results page, to remind the user of their specific search parameters.

Summary

In summary, we talked about the functionality of Wordpress's search feature and how it scans through the page of a website. Search prioritizes certain things, like the specific title of the page that matches the slug of the page as well as the query. We also talked about using the get_search_query function to return the exact query entered back to the user.