Skip to main content

How To Add Search Form In A WordPress Theme

Submitted by admin on Thu, 12/09/2021 - 09:15
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:

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;


Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.