How to Add Search Form in your WordPress Post

Most of the website owners underestimate the power of a search form or box on their websites. Some people even ignore the search box and publish websites without it.

Sometimes, some people discontinue it because they do not get any search query get disappointments easily, and think that it is a waste of space.

First of all, it is important to note that your search box may not get search queries in the initial days and only when you start getting huge traffic, you will start getting search queries as well.

But you should always have it on your website all the time because a website without a search form is considered bad for users by search engines.

How-to-Add-Search-Form-in-your-Post

As a matter of fact, you should also add a search form in the post with a WordPress search shortcode.

SearchFormInPost img 1 1

Here is an interesting stat that will motivate you to search form in your post with a WordPress search shortcode. Around 30% of the site visitors use the search bar when you place them on your post especially to find related articles.

As a matter of fact, the use of search form by users will provide you with enough ideas for writing articles. It is highly significant for blog-related websites as well as product promoting websites.

Why Should You Add Search Form In Your Post With A WordPress Search Shortcode?

  • New Keywords
  • If a visitor starts liking your posts, it is very likely that he will use the search form if you embed them in your post. Often, it is due to the lack of visibility of the search form that users never use them often.

    You will be able to discover new keywords and take immediate action by writing articles based on the demanding keywords that users are typing in your search box and searching articles on.

  • Optimization For Conversion
  • When you know what your audience is looking for, you can transform your website according to their requirement so that you get the maximum conversion rate.

    After all, you aim to create a website from which you can earn money and provide your audience with what they want. You can have only the relevant items on your website that are always going to be a hit.

    SearchFormInPost img 2 1

  • User Experience and SEO
  • When your website starts getting good enough traffic, you need to improve user experience otherwise, your users will prefer your competitor over you. If you add a form in your post with a WordPress search shortcode, you are providing a basic improvement in user experience.

    It is a known fact that if the user experience goes up, your search engine rank goes up exponentially. Everything that you put on the website is crawled by Google bots and if your website is better than your competitors in terms of user experience, you are going to get a higher position.

  • Tags In Posts
  • Based on the analytics of the search form, you can target different users of different countries and set up paid campaigns accordingly to get maximum reach. Furthermore, based on the popular keywords typed on the search form, you can add tags to your new articles so that they appear the next time the users type the same keywords.

    Steps To Add Form In Your Post With A WordPress Search Shortcode-

    Even though some people like the idea of having a search form in the post, but they make the mistake of copying and pasting lengthy codes in every post to make the search form appear. But you might be aware of the fact that the more lines of code you apply, the more time it would take to execute them.

    So, it is a bad idea to copy paste codes. Instead, you can search form in your post with a WordPress search shortcode and it would be convenient for you.

    SearchFormInPost img 3 1

    For that, you have to go to your theme’s functions.php file. Go to Admin Dashboard and then go to Appearance on the left menu and click on Editor. On the left side, spot the functions.php file and edit it. Paste the following line of code.

    add_shortcode(‘wpsearchf’, ‘get_search_form’);

    It is important to note that wpsearchf is the shortcode that you are going to use to add form in your post with a WordPress search shortcode like [wpsearchf]. Once you paste this shortcode, the default search form will appear.

    Custom Search Form –

    If you want to show a custom search form which is what users will prefer, you have to paste the following code in the functions.php file.

    function wpsearchformf( $form ) {
         $form = '
        <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label>
            
        </div>
        ';
         return $form;
    }
     add_shortcode('wpsearchf', 'wpbsearchform');
    

    If you want, you can create a user-defined plugin write the code in that plugin, and use it throughout your WordPress in the same way.

    Plugins To Add Search Form In Your Post With A WordPress Search Shortcode-

    SearchFormInPost img 4 1

    If you are wondering whether any plugin is available to make the process easy for you, there is good news. The name of the plugin is Ivory Search but you can only show a default search form in the post instead of a custom search form which is better for user experience.

    To install the plugin, go to Admin Dashboard, then from the left menu, go to Plugins, and click on Add New. Type the name of the plugin in the search box and install and activate it. Go to the settings of the plugin from the left menu on the Dashboard and type in the shortcode that you want to use on your post every time you create a new one.

    It is always recommended to go for the coding process rather than the plugin due to the feature of the custom search box. Go ahead and add a search form in your post with a WordPress search shortcode and watch your rank and conversion rate increase.

    Relevant Post: How to Create Advanced Search Form In WordPress website

    About Sonnal S Sinha

    Sonnal S SinhaSonnal S Sinha is a passionate writer as well as WordPress and WooCommerce rockstar who loves to share insights on various topics through his engaging blog posts. He runs a successful website design and digital marketing company. With 15+ years of experience in WordPress theme development, he strives to inform and inspire readers with his thought-provoking content. He helps thousands of small and medium businesses and startups create a unique online presence. Follow Sonnal S Sinha for your regular dose of knowledge and inspiration.