Setup & site building · Guide
How to Add and Improve Search in WordPress

Short answer
To add a search bar in WordPress, type /search on an empty line in the block editor and press Enter, or add the Search block from the inserter. Put it in a page, in the header template part of a block theme, or in a sidebar or footer widget area. Set the button position and placeholder text, then test it with terms your readers use.
Key takeaways
- The Search block is built into WordPress and needs no plugin for a basic search bar.
- Button positions are outside, inside, no button, or button only.
- Default search looks at post titles, excerpts and content only, not tags, categories or custom fields.
- Jetpack Search is free for up to 5,000 records and 500 search requests a month.
- Search results use the s query variable, with URLs like /?s=keyword.
How do you add a search bar to a page or post?
Add the Search block: type /search on an empty line and press Enter, or click the block inserter (+) and search for “Search”.
The Search block is built into WordPress, so no plugin is needed for a basic search bar. WordPress.org documentation states that you use the Search block to place a search widget on your page or post.
Follow these steps:
- Open the page or post in the block editor.
- Click on an empty line and type
/search, then press Enter. - Click the placeholder text and type a hint, such as “Search guides” or “Search products”.
- Choose the button style in the block toolbar: text, icon, or no button.
- Publish or update the page.
The block drops a search field and a button straight into the content. A visitor types a term, clicks Search, and WordPress opens the search results page for that term. The guide to fixing search that does not work covers what to check when the results page shows nothing.
If the Search block is missing from the inserter, you can find blocks through the Block Directory. Learn WordPress states that the Block Directory searches the free plugin directory for blocks and installs them without leaving the editor.
How do you add a search bar to the header or menu?
In a block theme, open Appearance, then Editor, open the header template part, and add a Search block beside the Navigation block.
The header is the best place for search on most sites, since it appears on every page. The steps match the page method, but the location changes:
- Go to Appearance, then Editor in the dashboard.
- Open the header template part.
- Select the Navigation block, or the row that holds your menu.
- Add a Search block beside it with the block inserter (+).
- Set the button to “Button only” if space is tight, so only a magnifier icon shows.
- Save the template part.
A “Button only” search bar takes little room in a header. WordPress.org documentation states that the “Button only” setting displays only the Search button and hides the input field, which suits a header where the field can open on click.
In a classic theme, the header is built by the theme, not by blocks. Check the theme settings under Customize, or add the Search widget to a header widget area if the theme offers one. If neither exists, a dedicated search page linked from the menu is the fallback.
How do you add a search bar to a sidebar or footer?
Open Appearance, then Widgets, and add the Search block to a widget area such as the sidebar or footer.
Widget areas are the classic way to show search on every page without editing the header. The Search block works there just like it works in a post. Add it, set the placeholder text, and save the widget area.
Keep the sidebar search simple. A short placeholder such as “Search this site” and a button outside the field is enough. Long labels and extra options crowd a narrow sidebar and push other widgets down the page.
Check the result on a phone. A sidebar often moves below the content on small screens, so the search bar may sit at the very bottom of a long page. If that matters, put the search bar in the header as well, and keep the sidebar one for desktop readers.
What can you change on the Search block?
You can change the button position, the button style, the placeholder text, and the colors, typography, border and spacing.
The block toolbar offers four button positions, as listed in WordPress.org documentation:
- Button outside, the default, with the button beside the field.
- Button inside, with the button as part of the field.
- No button, which shows only the field and runs the search on Enter.
- Button only, which shows only the button and hides the field.
The button can show text or an icon. WordPress.org documentation states that the search button can be either text or icon, so a magnifier icon works when space is tight or the site runs in more than one language.
The block settings panel adds more controls. The same documentation lists color settings for text and background, typography settings for font family and size, border settings for border and radius, and dimension settings for padding and margin. Change one thing at a time and preview after each change, since a wide field with large padding can break a narrow header.
What does WordPress search by default?
WordPress searches post titles, excerpts and content, and returns matching posts and pages on a results page.
The default search is narrow by design. Developer.WordPress.org documents the search_columns argument, which accepts post_title, post_excerpt and post_content, and nothing else by default. Categories, tags, custom fields, comments and PDF text are not searched.
Search results use the s query variable, and the results URL looks like /?s=keyword. You can open that URL by hand to check what a term returns, without touching the search bar at all.
Results are ordered with title matches first. A post with the term in its title ranks above a post with the term only in its body, so clear titles matter. A post titled “How to reset your password” beats a post that mentions passwords in passing, even when the second post is longer.
How do you improve search results?
Write clear titles and excerpts, keep the content the search covers, and add a search plugin only when the default scope is not enough.
Most bad search results come from bad content, not from a bad search bar. Fix the content first:
- Give every post a title that names its topic in plain words.
- Write a short excerpt that states what the post covers, since excerpts are searched.
- Use the exact words readers type. A post about “resetting a password” should say “reset password”, not only “recover access”.
- Remove thin posts that match many terms but answer none of them. They clutter results.
When the default scope is the problem, a search plugin helps. Jetpack Search adds instant results, spelling correction and filters by category, tag, date, custom taxonomy and post type. Its free tier covers sites with up to 5,000 records and 500 search requests a month, as stated on its WordPress.org plugin page.
| Improvement | What it fixes | Cost |
|---|---|---|
| Clear titles and excerpts | Wrong posts ranking first | Free |
| Search block in the header | Readers cannot find the search bar | Free |
| Jetpack Search free tier | No filters, no instant results, no spelling help | Free to 5,000 records and 500 requests a month |
| Jetpack Search paid | Larger sites, more requests | From $8.33 a month, billed yearly |
The paid price comes from Jetpack, which lists Jetpack Search at $8.33 a month when billed yearly. Check the current price on that page before you buy, since pricing changes.
The guide to adding AI search to a WordPress site covers a different upgrade path, where search answers questions instead of listing posts. Pick one upgrade at a time and measure the change before you add another.
How do you check that search works?
Search for five terms your readers actually use, and read the results page as a visitor would.
Run this check after you add the bar:
- Search for a term that should match one clear post, and confirm that post is first.
- Search for a term that should match nothing, and confirm the no-results page is helpful.
- Search for a term with a typo, and see whether the results still help.
- Search on a phone, and confirm the field and button fit the screen.
- Check the results page in Search Console after a week, to see which terms visitors search for.
The guide to using Google Search Console with WordPress shows how to connect the site and read the queries that bring visitors in. Those queries are the terms your on-site search must handle well.
What mistakes should you avoid?
Do not hide the search bar, do not expect it to search everything, and do not install a search plugin before fixing your titles.
- Do not put search only on a single page. Readers look for it in the header or sidebar on every page.
- Do not expect default search to find PDF text, tag names or custom fields. It searches titles, excerpts and content only.
- Do not add three search plugins at once. They fight over the same results page, and the site slows down.
- Do not use a vague placeholder such as “Type here”. A placeholder should say what to search, such as “Search 500 guides”.
- Do not ignore the no-results page. A blank page with “Nothing found” ends the visit. Add links to popular posts and a contact link instead.
The guide to what Gutenberg is explains the block editor behind the Search block, which helps when the block behaves differently from the classic widget you used before. A visible search bar on clear content beats a hidden bar on a large site.
Frequently asked questions
How do I add a search bar to my WordPress menu or header?
In a block theme, open Appearance, then Editor, open the header template part, and add a Search block beside the Navigation block. Use the Button only setting when space is tight, so only a magnifier icon shows. In a classic theme, check the theme settings or add the Search block to a header widget area if the theme offers one.
Why does WordPress search not find my post?
Default WordPress search looks at post titles, excerpts and content only, so it misses tags, categories, custom fields, comments and PDF text. If the term lives in one of those places, the post will not appear. Rewrite the post so the term appears in its title or excerpt, or add a search plugin that covers more fields.
How can I improve my WordPress search results?
Write clear titles and excerpts that use the exact words readers type, since title matches rank first. Remove thin posts that match many terms but answer none of them, because they clutter the results. Add a search plugin only after the content is fixed, since a plugin cannot rescue vague titles.
Is there a free way to get better WordPress search?
Jetpack Search is free for sites with up to 5,000 records and 500 search requests a month. It adds instant results, spelling correction and filters by category, tag, date, custom taxonomy and post type. The paid plan starts at $8.33 a month when billed yearly, for 10,000 records and 10,000 requests.
Does the search bar work on mobile?
Yes. The Search block works in widget areas, and a sidebar often moves below the content on small screens, so check the page on a phone. Keep the placeholder short, such as Search this site, and use a button icon rather than long text when the sidebar is narrow.
Do I need a plugin to add a search bar?
No. The Search block is built into WordPress and adds a working search bar to any page or post. A plugin is only needed when you want instant results, filters, spelling correction or search across custom fields and taxonomies.
Sources
- Search block WordPress.org
- WP_Query::parse_query() Developer.WordPress.org
- Jetpack Search WordPress.org
- Jetpack Search Jetpack
- Add New Blocks to Your Site Using the Block Directory Learn WordPress
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


