How to Add Search Form in your WordPress Post

How-to-Add-Search-Form-in-your-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 and 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 query in the initial days and only when you get 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. As a matter of fact, you should also add search form in post with a WordPress search shortcode.

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 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 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?
1. New Keywords – If a visitor start 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 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 article on.

2. 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 maximum conversion rate. After all, your aim is to create a website from which you can earn money and provide your audience what they want. You can have only the relevant items on your website that are always going to be a hit.

3. 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 form in your post with a WordPress search shortcode, you are providing the 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.

4. 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-
Every though some people like that idea of having a search form in the post, but they make a 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 really convenient for you.

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 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 would 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 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 and 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-

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 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 Shri Posts

Shri shares exciting WordPress themes, plugins and other WordPress related news for our viewers. He also posts selected WordPress developers interviews from time to time.

SKT Free Software Theme