Do you want to add a search form to a WordPress post?
By adding a search bar to your post’s content, you can help visitors find more great content and keep them on your site for longer.
In this article, we’ll show you how to add a search form in a WordPress post.
Why Add a Search Form to Your Posts and Pages?
If a visitor has enjoyed a post on your WordPress website, then it’s likely they’ll want to read more. By adding a search form to a post you can help visitors find more blogs they’re interested in reading.
In this way, you can increase your pageviews and reduce your bounce rate.
The longer visitors stay on your website, the greater chance they’ll join your email list, leave a comment, make a purchase, follow you on social media, or take other positive actions.
In this guide, we’ll show you how to add the standard WordPress search form to your posts. If you want to use a custom form instead, then see our step-by-step guide on how to create a custom WordPress search form.
Having said that, let’s take a look at how to easily add a search form in a WordPress post. Just use the quick links below to jump straight to the right method you want to use.
Method 1. How to Add a Search Form in a WordPress Post (Works With All Themes)
The simplest way to add a search form to your posts is by using the built-in Search block.
In this guide, we’ll show you how to add the block to a post, but you can also add it to any page or widget-ready area of your site.
To get started, simply open the page where you want to add a search form. In the WordPress content editor, click on the + icon.
In the popup, type in ‘Search.’ When the right block appears, click to add it to the page.
By default, the block uses ‘Search’ for both its label and the button text. This text will be visible to visitors, so you may want to replace it with something more descriptive.
For example, if you’re adding the search bar to a WordPress blog, then you might want to use ‘Search recent blog posts’ or similar.
You can even use the label and button text to motivate your visitors.
You can also add some placeholder text. This text will disappear automatically when the visitor starts typing.
To add a placeholder, simply click on ‘Optional placeholder…’ and then start typing.
By default, WordPress will use your theme to style the search bar.
However, you can change the button’s background and text color using the ‘Color’ settings in the right-hand menu. This can help your search bar stand out from the rest of your site.
When you’re happy with how the Search block looks, you can go ahead and either publish or update the post. If you visit your site, you’ll now see the search bar within the post’s content.
You can add a search form to more WordPress posts and pages following the same process above. For detailed instructions on how to add the Search bar to a sidebar or similar section, please see our guide on how to add and use widgets in WordPress.
Method 2. How to Add a Search Form to All WordPress Posts (Block-Based Themes)
In this way, you can quickly and easily add a search bar to every single blog post across your entire WordPress website.
To open the full-site editor, go to Themes » Editor in the WordPress dashboard.
By default, the full site editor shows your theme’s home template.
To see all the available options, select ‘Templates’ from the left-hand menu.
This shows a list of all the templates that make up your WordPress theme.
To customize the blog template, go ahead and click on ‘Single.’
WordPress will now show a preview of the blog layout.
To go ahead and edit this template, click on the small pencil icon.
You will now see this template in the full-site editor.
To go ahead and add a search bar, click on the blue ‘+’ icon.
In the popup that appears, type in ‘Search’ to find the right block.
You can now drag the block to the location where you want to show the search bar.
To customize the block title or placeholder text, simply type the new messaging into the search block.
When you’re happy with how the block looks, click on ‘Save’ to make the search bar live.
Now, if you visit any blog post on your site, you’ll see the search bar.
How to Improve WordPress Search
The Search block uses WordPress’ built-in search feature. However, this is quite limited and not very good at showing accurate results.
That’s where SearchWP comes in.
SearchWP is the best custom search plugin for WordPress. It gives you complete control over the WordPress site search so you can deliver more accurate results to your visitors.
SearchWP also makes all parts of your site searchable, including PDF files, ACF files, text files, WordPress custom fields, and more.
After creating a custom search form, you can add it to any part of your website using either a block or shortcode.
To learn more, please see our guide on how to improve WordPress search with SearchWP.
We hope this tutorial helped you learn how to add a search form in a WordPress post. You may also want to learn how to create a contact form in WordPress or check out our expert pick of the best email marketing services for small businesses.