SearchWP Blog

WordPress Tutorials, Tips, and Resources to Help Grow Your Business

How to add Meta Box fields to WordPress search

WordPress search is fine for finding basic stuff on your website, but what if you’re using the Meta Box plugin and want to make extra information searchable?

Meta Box is popular for creating custom fields, post types, and taxonomies, where you can store extra information for your posts and pages. They are super useful for organizing your website content in exactly the way you need.

However, there is a catch: WordPress’s default search ignores all that extra information you’ve carefully put into Meta Box fields. If someone searches for a specific detail you’ve added in Meta Box, they won’t find it with the default search.

Luckily, there’s a way to fix this! You can make WordPress search smarter so it includes your Meta Box fields. While there are some complicated code-based ways to do this, the easiest is to use a plugin like SearchWP.

In this article, we’ll show you how to add Meta Box fields to WordPress search without editing code.

Why Make Meta Box Fields Searchable in WordPress?

Making your Meta Box fields searchable can seriously improve your website.

First off, it makes your search results way more relevant. Users are much more likely to find exactly what they’re looking for when the search looks everywhere, including those custom fields you’ve set up with Meta Box.

This better search experience makes your visitors happier. Instead of getting frustrated and leaving your site, they can find the information they need and stick around longer.

For sites that rely heavily on custom post types and lots of extra data managed by Meta Box, this is especially important.

Imagine someone searching for a ‘blue shirt’ on your online store. If you’ve used Meta Box to create a ‘color’ custom field for your products, and your search includes those fields, then visitors will actually find what they are looking for.

Similarly, think about real estate websites where you might store address, price, and number of bedrooms in Meta Box fields. Or imagine a recipe site with ingredients and cooking time as custom fields. Being able to search within these fields is super powerful.

That said, let’s look at how you can easily include Meta Box fields in your WordPress search process.

Add Meta Box Fields to WordPress Search

There are different ways to include Meta Box fields in WordPress search. One way involves using code and getting into the technical side of WordPress. But if you’re not a developer, then it’s probably not the best path.

The easier method is to use SearchWP. It is the best search plugin for WordPress and designed to make WordPress search much better.

SearchWP comes with powerful features and offers a Meta Box extension. Plus, it’s user-friendly to use, and you don’t need to write any code to include Meta Box fields.

To start, you can visit the SearchWP website and sign up for a new account.

SearchWP

Next, you’ll need to do is download the SearchWP plugin.

To do that, head to your account area and switch to the ‘Downloads’ tab. From here, you can click the Download SearchWP button and save the plugin file to your computer.

Download SearchWP plugin from account area

After that, you can install and activate the SearchWP plugin on your site. For more details, please see this guide on how to install the WordPress plugin.

Once the plugin is active, SearchWP will show a setup wizard in your WordPress dashboard. Go ahead and click the ‘Start Onboarding Wizard’ button and follow the onscreen instructions.

Onboarding wizard SearchWP

Next, you can head to SearchWP » Extensions from the WordPress dashboard to install the Meta Box extension.

Go ahead and click the ‘Install’ button under Meta Box Integration.

Install meta box extension

The extension will now automatically install and activate. You’ll see the Status change from Not Installed to Active.

Now, you can customize the search engine settings and include your Meta Box fields and tables in the search process.

Change Search Settings to Include Meta Box Fields

Next, you can edit the WordPress search settings using SearchWP and include information from Meta Box.

SearchWP also lets you set up multiple search engines and link them to different search forms. This way, you can help customers find exactly what they are looking for by narrowing down the search process.

To start, you’ll need to head to the SearchWP » Algorithm page from your WordPress dashboard. After that, you can edit the default WordPress search or add a new engine.

For this tutorial, we created a custom post type called Recipes and added custom fields using Meta Box.

To include them in the search process, we’ll add a new engine in SearchWP. Simply click the Add New button to get started.

Add new engine

A new popup window will now open. Here, you can select the ‘Sources’ for your search engine, such as posts, pages, and media files that the plugin will use to find content on your site.

Go ahead and select your Meta Box custom post type or taxonomy as a source. For example, we’ll select the Meta Box post type called ‘Recipes’ as a source for our engine.

Enter new engine details

You can also change the name of the search engine under the ‘Engine Label’ field.

When you’re finished, simply click the ‘Done’ button.

After that, you can choose the attributes you want to search for each source in the engine. These are fields you want to search for a given source, such as title, content, slug, author, custom fields, tags, or categories.

Go ahead and click the ‘Add/Remove Attributes’ button.

Add meta box attributes

Next, you’ll see a new popup window open.

From here, you can click the Custom Fields dropdown menu and select your Meta Box custom fields to include in the search process.

For example, we picked the ‘ingredients’ custom fields as attributes for our Recipes source.

Add meta box custom fields

You can also include categories and tags created in Meta Box by selecting them under the ‘Taxonomies’ section.

After adding attributes, go ahead and click the ‘Done’ button.

Move slider for meta box attributes

Once you’ve added custom fields and taxonomies as attributes, SearchWP also gives you the option to move the slider and adjust the relevance weights. The further to the right the slider is set for an attribute, the more influence that attribute has on the position in the search results.

When you’re done, simply scroll to the top and click the ‘Save’ button to store your changes.

Save engine settings

That’s it, you’ve successfully included Meta Box fields in WordPress search.

Create a Custom Meta Box Search Form

Next, you can link your new search engine to a custom search form in SearchWP and display it anywhere on your site.

To do that, simply head to SearchWP » Search Forms from the WordPress dashboard. Here, you can select an existing form or add a new one.

Add a new search form

After that, you can change the name of your search form at the top.

Next, you’ll need to select a Layout Theme for your form. SearchWP offers multiple pre-built templates, which makes it very easy to pick a layout and customize it.

Select search form layout

You can now scroll down to the ‘Custom Styling’ section.

From here, simply click the ‘Engine’ dropdown menu and select the new search engine you created earlier.

Select new engine for form

You’ll see more customization options if you scroll down, such as changing the form style, button style, and more.

Once that’s done, simply scroll to the top and click the ‘Save’ button.

Save meta box search form

After that, you can click the ‘Embed’ button and choose how you’d like to add the new search form to your site.

SearchWP lets you use a Gutenberg block, shortcode, or PHP code to embed the form.

Embed new search form

Next, you’ll need to select whether you’d want to embed the form on a new page or an existing page. For this tutorial, we’ll pick the ‘Create New Page’ option.

On the next screen, you can enter a name for your new page and click the ‘Let’s Go!’ button.

Enter name for new page

After that, you’ll see a preview of your search form in the WordPress content editor.

When you’re done, simply click the ‘Publish’ button.

Publish your meta box search form

You’ve successfully added a custom search form for Meta Box fields.

Go ahead and visit your website to see it in action. You can try searching for Meta Box custom fields and other information to see if it’s working.

View meta box search engine

If you want to learn more, then please see our guide on how to create a custom search form in WordPress.

We hope this article helped you learn how to add Meta Box Fields to WordPress search. You may also want to see our guide on how to include ACF fields in WordPress and how to limit search to specific post types in WordPress.

Ready to make Meta Box fields searchable on your site? You can get started with SearchWP here.

author avatar
Aazim Akhtar

Create a Better WordPress Search Experience Today

Never lose visitors to unhelpful search results again. SearchWP makes creating your own smart WordPress search fast and easy.

Get SearchWP Now
Multiple Search Engines Icon