Most users tend to ask if there is an easy way to add the WordPress Search Form in your post or page content using a shortcode. Well, the answer to that question is Yes. In this article, we will show you how to add the WordPress search form in your post or page content by creating a WordPress search shortcode.
In order to make changes in the WordPress search form using PHP code, you can find the file either in the parent or child directory. Find it from there and lead it.
All you have to do is open your theme’s functions.php file or a site-specific plugin and paste the following code:
Then use the shortcode in your post/page content like so: [wpbsearch]
Make sure to understand that this code is primarily used to hardcode the search form. It is mainly done to change the search form to a sidebar along with a search widget for WordPress.
This will display the default search form. If you want to display a custom search form, then you can do so like this:
To reduce complication and make configuration easy, as fast as 5 minutes use WP fastest site search plugin by Expertrec
- Install WP fastest site search plugin from WordPress plugin store.
- Go to https://cse.expertrec.com/newuser?platform=wordpress.
- Enter your WordPress website URL and click on next->
- The crawl will start in the background.
- Login to your WordPress admin panel.
- In your left panel you must be able to see expertrec’s WordPress plugin, click on that.
- Get your site ID (or) API key from your expertrec control panel ( here ).
- Copy paste your site id in your WordPress control panel and click on save changes.
- Make sure you have upgraded to a paid plan before 15 days of free trial. (Price begins at 9 USD per month)
- That’s it! Your brand new WordPress search is up and running!
For more details on Search Form, view the video