---
title: "How to Add a Search Bar in WordPress?"
url: https://nexterwp.com/docs/add-a-search-bar-in-wordpress/
date: 2024-12-02
modified: 2026-09-27
lang: en
author: "Aditya Sharma"
description: "WordPress ships with a search box, and it is not very good. It searches title and content together, sends every visitor to a separate results page, and gives you nothing..."
image: https://nexterwp.com/wp-content/uploads/2024/12/How-to-Add-a-Search-Bar-in-WordPress_-1024x519.jpg
word_count: 865
---

# How to Add a Search Bar in WordPress?

## Key Takeaways

- Search Bar block reemplaza la búsqueda predeterminada de WordPress con controles para elegir tipos de contenido, campos coincidentes, un desplegable de taxonomía y resultados bajo el cuadro mientras el visitante escribe.
- Nexter Blocks activa Search Bar desde Nexter > Blocks en el panel de WordPress, y la edición Free funciona igual con Nexter Blocks Pro desactivado.
- AJAX search debe estar activado para mostrar resultados al escribir, y el bloque usa un límite de caracteres que retrasa las solicitudes hasta que el visitante escribe al menos la cantidad configurada.
- Search Bar busca texto, no significado: por defecto solo busca el título, un término parcial puede devolver 4 entradas, una coincidencia completa puede devolver 0, y cambiar a contenido amplía el conjunto de resultados de 4 a 15.

WordPress ships with a search box, and it is not very good. It searches title and content together, sends every visitor to a separate results page, and gives you nothing to configure.

The Search Bar block replaces it with something you control: which post types are searched, which fields are matched, whether a taxonomy dropdown sits beside the input, and whether results appear under the box as the visitor types.

[LIVE BLOCK LINK](https://nexterwp.com/nexter-blocks/builder/wordpress-ajax-search-bar/)

https://www.youtube.com/watch?v=5l815ppOEMM

## Before You Start

- **Edition:** Free. Measured with Nexter Blocks Pro deactivated, the Search Bar renders identically — form, input, dropdowns, suggestions and results all work without Pro.- **Block to enable:** Search Bar, switched on under **Nexter > Blocks** in your WordPress dashboard.- **Published content to find.** The block searches your real posts, so a site with nothing published returns nothing.

## Steps

- Add the **Search Bar** block to your page.

![Adding the Search Bar block](https://nexterwp.com/wp-content/uploads/2026/09/sb-select-block.webp)

- Set the **placeholder** text so visitors know what they can search for.

![The placeholder setting](https://nexterwp.com/wp-content/uploads/2026/09/sb-placeholder.webp)

- Choose which **fields** the search matches — title, content, excerpt, slug, category or tag.

![Choosing the search fields](https://nexterwp.com/wp-content/uploads/2026/09/sb-generic-filters.webp)

- Add a **filter field** sourced from a **taxonomy** if you want a working dropdown beside the input — category, tag or a custom taxonomy.

![Adding a filter field](https://nexterwp.com/wp-content/uploads/2026/09/sb-field-tax-category.webp)

- Switch **AJAX search** on to show results under the box as the visitor types.

![Enabling AJAX search](https://nexterwp.com/wp-content/uploads/2026/09/sb-ajax-toggle.webp)

- Pick a **result style** and decide what each result card shows.

![Result style settings](https://nexterwp.com/wp-content/uploads/2026/09/sb-results-visibility.webp)

- Choose how longer result sets are handled — pagination, a load more button or lazy loading.

![Result loading options](https://nexterwp.com/wp-content/uploads/2026/09/sb-loading-loadmore.webp)

- Publish and search for something you know exists.

![The finished search bar](https://nexterwp.com/wp-content/uploads/2026/09/sb-fe-main.webp)

## How It Behaves

The whole configuration is written onto the block wrapper as data attributes, and the script reads them to build each request. That is why every setting below takes effect without a page reload.

- **Only the title is searched by default.** Measured: with the default settings a term matched 4 posts by title; switching the search fields off entirely fell through to WordPress's own query and matched 15.- **Full match is different from partial match.** Measured: a partial search for a common word matched 4 posts by title, while the same term as a full match returned 0, because full match requires the entire field to equal the term.- **A filter dropdown narrows the query before it runs.** Measured: choosing a single category returned exactly the 2 posts in it, out of 14.- **AJAX search has to be switched on** for results to appear as you type. With it off the bar behaves as a plain form that submits to WordPress's own search page.- **A character limit holds the search back.** Nothing is requested until the visitor has typed at least the configured number of characters, which keeps a long list of requests from firing on the first letter.- **It degrades to an ordinary search.** The block renders a real `<form method="get">` pointing at your site root, so with JavaScript disabled the bar still submits and lands on WordPress's own search results.- **The excerpt line only appears when the post has one.** Measured: posts with an empty excerpt render a card with no excerpt at all, which can make a result list look uneven.

## Limitations

- **Search matches text, not meaning.** A search for a synonym of a word in your title will not find it.- **Matching more fields means slower, broader results.** Turning content matching on took a measured result set from 4 to 15 on the same 14-post site.- **Product search needs WooCommerce.** Without it the request returns an error rather than an empty result list.- **Show All Result does not currently render usable cards.** Measured on 5.0.6: the pre-loaded list renders three empty placeholders with no title, thumbnail or link, and ignores the result count you set. Reported to the developers. Leave it off and let the visitor search.- **The per-field “post type” source does not work.** Measured on 5.0.6: choosing Post as a filter field's source saves with no post type attached and has no effect on the search. To restrict the whole bar to one post type, use **Extra Option → Only for specific CPT** instead — that setting is measured working. Reported to the developers; see [the posts-only doc](https://nexterwp.com/docs/add-search-bar-for-posts-in-wordpress/) for the detail.- **Custom field search does not currently return results.** Measured on 5.0.6 across several terms and fields: always zero. Reported to the developers; see the [custom field search doc](https://nexterwp.com/docs/search-posts-by-custom-field-in-wordpress/) for the detail.

## Troubleshooting

### Nothing happens when I type

AJAX search is off by default. With it off the bar only reacts when the search button is pressed, and then it submits to WordPress's own results page.

### Results only start after a few letters

That is the character limit doing its job. Lower it if you want results sooner, but expect more requests.

### A post I can see is not in the results

Check which fields are being matched. By default only the title is searched, so a term that appears only in the body will not match.

### The results have no thumbnails

Either the thumbnail toggle is off, or those posts have no featured image set.

### The results are not clickable

The result link option is what puts the link on the card. With it off the card renders with no `href` at all.

## Related Docs

- [Add a search bar for posts](https://nexterwp.com/docs/add-search-bar-for-posts-in-wordpress/)- [Search posts by title only](https://nexterwp.com/docs/search-posts-by-title-only-in-wordpress/)- [Add AJAX search for WooCommerce products](https://nexterwp.com/docs/add-ajax-search-for-woocommerce-products-in-wordpress/)- [Add AJAX pagination to search results](https://nexterwp.com/docs/add-ajax-pagination-to-search-results-in-wordpress/)- [Advanced tab settings](https://nexterwp.com/docs/use-advanced-tab-in-nexter-blocks/)

## Frequently Asked Questions

**Q: Why does the search bar only show results after I type a few letters?**
A: That behavior comes from the character limit. The block waits until the visitor has typed at least the configured number of characters before it sends a request, which cuts down on noisy searches and request spam from the first keystroke. If you want results sooner, lower that limit, but expect more requests to fire as people type.

**Q: Why is nothing happening when I type in the search bar?**
A: AJAX search is off by default, so typing alone does not trigger live results. In that mode the bar behaves like a plain form and only submits when the search button is pressed, sending the visitor to WordPress’s own results page. Nexter Blocks uses AJAX only when you switch it on for the Search Bar block.

**Q: Can this search bar work if JavaScript is disabled?**
A: The block still degrades to a normal WordPress search form because it renders a real  pointing at your site root. That means visitors without JavaScript are not blocked, but they will land on WordPress’s own search results page instead of seeing live suggestions under the box.

**Q: What should I use if I want to search only post titles?**
A: Title-only searching is the cleanest setup when you want tighter matches and fewer false positives. The Search Bar block can match title, content, excerpt, slug, category, or tag, but by default only the title is searched. Nexter Blocks also has a separate [Search posts by title only](https://nexterwp.com/docs/search-posts-by-title-only-in-wordpress/) doc if you want that narrower behavior on purpose.

**Q: Why are some posts missing from the search results?**
A: By default, only the title is searched, so a post that matches in the body but not in its title will be skipped. The page also notes that matching more fields broadens results, while turning content matching on increased one measured result set from 4 to 15 on the same 14-post site. If you need broader coverage, add more fields carefully because that also makes results less selective.

**Q: Does this search bar work for WooCommerce product searches?**
A: Product search needs WooCommerce. Without it, the request returns an error rather than an empty result list. Nexter Blocks has a separate [Add AJAX search for WooCommerce products in WordPress](https://nexterwp.com/docs/add-ajax-search-for-woocommerce-products-in-wordpress/) guide for that use case, so product lookup should be treated differently from normal post searching.
