Add search to your WordPress website

Have you ever stumbled upon a new business or site that seems like it might change your life? When I was training for a marathon last year, I found Jane on Instagram + quickly worked my way through the mountain of blog posts she had available to endurance runners like me.

Some of our site traffic has been with us from the start. But more often than not, they are newer + don’t know all of the content you have available. Which is why having a search option + clear navigation menu is essential for your business site / blog.

Adding a search bar to WordPress has gotten so much easier in the past few years. When I was building sites a decade ago, I had to use PHP code to get one to show up — get_search_form( $echo ); Sure that’s not a lot of characters, but if you’re not interested in learning PHP, you probably want nothing to do with that way of adding search to your site.

The good news is that your site likely has 2 ways to add one. No additional plugins required!

The first option is the way that’s been around for the longest + requires your site to utilize the sidebar or widget area (which some themes don’t.) Head to Appearance > Widgets + notice what sidebar options you have. If your blog or posts has a sidebar on the right or left side, you’ll be able to add a search box to that sidebar. This will help your visitors find even more content to devour!

The second option is my personal favorite, because you can use it anywhere. Gutenberg has the Search Block available on all pages, posts + other content types. The same is true for Divi, Elementor, Beaver Builder, etc. When building a page, simply add the block where you want it + customize based on the settings provided.

WordPress gives you the option to title your Search area, customize the placeholder, use a search button or icon + customize where exactly it appears. They even have the option to ditch the button entirely, but I wouldn’t recommend that.

Where should you place a search bar? At a minimum, I’d add it to 2 places:

  1. Your blog / podcast / articles area to allow visitors to find even more relevant content. Even if you have related posts or categories listed in the sidebar, the option to search is an invitation for site visitors to stay. How lovely is that?
  2. Your 404 or error page. Don’t have one? Set aside time to add one to your site ASAP. This page is what’s shown when a link is broken. We all love to think we are free of broken links, but since we can’t edit references to our sites on social media, it’s worth covering the bases. A search on this page helps visitors track down what they intended to find — instead of them seeing a blank screen + closing that tab to find someone else who can help them.

I’d suggest testing your search results page before adding a Search bar + then walking away. You can do this by adding ?s=word to your domain. Change the word to something relevant to your business — no spaces either. Or you can preview the page you’re editing + see what happens when you use the Search that you’re adding.

on your keyboard hit enter to search or esc to close