Skip to main content

How To Add Search Form In A WordPress Theme

Submitted by admin on Thu, 12/09/2021 - 09:15
wordpress-search-form
WordPress has a inbuilt search form to search content on the website. In this tutorial we will learn how we can add WordPress core search form in a theme.

Search Form Code

Just add below code in your theme template file where you wish to show search form and it will show WordPress core search form.

<?php get_search_form(); ?>

You will get default search form, something like this:
wordpress-search-form

Hide Search Form Label

If you want to hide the search form label text Search for:, just add below css code in style.css of your theme.

.screen-reader-text {
  display: none;
}

Tutorial Category