5R - WordPress Search

WordPress Search Functionality

The WordPress search bar is very useful as it allows users to enter a search query and WordPress will search for it by page titles, page content, single image titles and captions, image alt text and file names. However WordPress search bar does not search for widgets, user comments, categories, tags, image gallery titles, captions, or alt text. However there are additional plugins that allow you to search the content that WordPress doesn't allow you to. WordPress performs a search using the WP_Query class and displays any of the posts that have the users search term in the title, displaying by the newest entry at the top of the search.

The role of the URI when searching

A URI is a Uniform Research Identifier which is a string of characters that are used to identify a resource. URI's are used to track down a file using its name and/or location. URI's have the ability to be either a protocol,designation (HTTP, file, data) or a specification. URI's are great for searching as a URI will identify the location and name of the resource.

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

Search forms are used to find specific parts of your site for example a blog post keyword. To show the current or active search term in the search form being used, all you have to do is custom fields. A name and value must be paired and code placed in the theme file in order for the custom field to work. There are four different ways to display the custom fields which are: the_meta() which is a template tag that lists all custom fields of your post, or get_post_custom() and get_post_meta() which get one or all metadata of a given post. Another way to display custom fields is: get_post_custom_values() and it searches for values for a custom post field. The last way is Template tags which are used in themes to find content from your database and can find more than just a blog or post.

Summary

The WordPress Search is a great way to attract visitors to your site as your site will be more advanced and accurate. WordPress search provides assistance to those that want to be or are engaged with your site and want to search for a given thing. Personalizing your search results page that comes up after someone searches something is also important and is a great way to improve the users experience.