Change placeholder text for wordpress search box

Change placeholder text for wordpress search box

Today we will learn how to Change placeholder text for wordpress search box.

Just Add the below code to the functions.php in your wordpress theme and all done. Placeholder text can be change/Replace to any text also Search button can be change to anything.

function html5_search_form( $form ) { 
     $form = '<section class="search"><form role="search" method="get" id="search-form" action="' . home_url( '/' ) . '" >
    <label class="screen-reader-text" for="s">' . __('',  'domain') . '</label>
     <input type="search" value="' . get_search_query() . '" name="s" id="s" placeholder="Search website" />
     <input type="submit" id="searchsubmit" value="'. esc_attr__('Go', 'domain') .'" />
     </form></section>';
     return $form;
}

 add_filter( 'get_search_form', 'html5_search_form' );

We hope this article helped you learn Change Placeholder Text for WordPress Search Box.

Additional Reading

28 thoughts on “Change placeholder text for wordpress search box”

  1. Tried this, but it did not work. How old is this article? (It says “05 Dec” but doesn’t say what year.)

  2. you are the best, and God sent.

    Please send me I need another help
    I have a members plugin
    it creates user
    My question is How do I fetch the users from my wordpress database to a front-end table in wordpress.
    I can get this done easily in php but in wordpress I am stuck.
    Would appreciate if I can learn from your wealth of experience.
    Thank You

    1. Hello RICARDO GARCIA DUARTE,
      Sorry for lare reply, i was in vacation that why could not reply in time.
      You can add this css to your theme. just go to
      Appearance->Customize->Additional CSS

      #searchsubmit {
      display: none !important;
      }

      Hit on Publish..Done
      Let me know if its not work

      Thanks

  3. i want to add placeholder in my wordpress search bar , i don’t want to make new search bar using the plugin , i want to change theme placeholder any help please….!

    1. Hello Serhat,
      Thanks for your Comment. Of course you can change the button text only with replacing below code

      Just Change ‘Go’ text with you desire text.

      Knock me if it will work for you.
      Thanks

Leave a Comment

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

0 Shares
Tweet
Share
Pin
Share