How To Add Search Form In A WordPress Theme

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.

1
<?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.

1
2
3
.screen-reader-text {
  display: none;
}

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *