Do you want to make custom fields searchable in WordPress?
WordPress doesn’t search custom fields by default, which can make it harder for your visitors to find what they need. By making custom fields searchable, you can provide a better user experience for your visitors.
In this article, we’ll show you how to make custom fields searchable in WordPress.
What Are Custom Fields & Why Make Them Searchable?
WordPress custom fields allow you to store any kind of additional information about a post or page, in the form of metadata.
By default WordPress adds metadata such as title, author, date, time, and more to your posts and pages. However, with custom fields you can add more information about your content and display that information on your website if you wish.
A lot of popular WordPress plugins and themes use custom fields to store important data. For example, the information you enter in WordPress SEO plugins such as All in One SEO is technically a custom field.
Some custom product attributes that you add to your WooCommerce products will also be custom fields.
However, when a visitor uses a search bar on your website, WordPress will only show them results where the title and content match their search terms.
Making your custom fields searchable can improve the user experience on your WordPress website. It allows your visitors to search for any content with ease, keeping them on your website for longer and avoiding any frustration.
That said, let’s look at how you can make custom fields searchable in WordPress.
Making Custom Field Searchable in WordPresss
The easiest way to make custom fields searchable is by using the SearchWP plugin. It’s the best WordPress search plugin and allows you to create more helpful and relevant search results by adjusting the search algorithm.
The plugin indexes everything on your WordPress site. For instance, it uses custom fields, PDF documents, text, custom tables, files, categories, shortcodes, and more to improve WordPress search for your users.
Besides that, SearchWP works seamlessly with other popular plugins like Advanced Custom Fields, Meta Box, Toolset, Easy Digital Downloads, WooCommerce, and Pods.
To start indexing your custom fields, first you’ll need to install and activate the SearchWP plugin. If you need help, then please see our guide on how to install a WordPress plugin.
Upon activation, you need to visit the Settings » SearchWP page and then click on the ‘License’ menu option.
Then, enter your license key in the ‘License’ box and click the ‘Activate’ button.
You can find the license key by logging into your SearchWP account.
Once you’ve done that, click on the ‘Engines’ tab. Here, you’ll see different sections where you can configure how SearchWP searches your posts, pages, and media.
To get started, simply scroll to the section where you want to add searchable custom fields. In our images, we’re adding custom fields to a site’s posts, but the steps will be exactly the same no matter what content type you’re working with.
In your chosen section, find the ‘Add/Remove Attributes’ button and give it a click.
In the popup that appears, click to open the ‘Custom Fields’ dropdown menu.
One option is to select ‘Any Meta Key’ which will make all your custom fields searchable. Another option is to type in the specific custom field that you want to include in your searches.
Once you’ve chosen the custom fields that you want to make searchable, click on ‘Done.’
SearchWP will now add a custom fields option to the section.
You can see that each custom field has an ‘Applicable Attribute Relevance’ slider which controls the weight given to each attribute during a search.
For example, if you move the slider to the right then SearchWP will give more weight to the data in your custom fields. This means they will have more impact on where the post appears in the search results.
To make custom fields searchable for your pages and media files, simply repeat the same process described above.
Once you’ve added all your custom fields, don’t forget to save your changes by clicking on the ‘Save Engines’ button.
SearchWP will now index your content, PDF metadata, custom fields metadata, images, files, and any other types of metadata that you’ve chosen to include in your website’s search.
You can see the ‘Index Status’ in the right corner along with how many times the SearchWP plugin has indexed.
If you see a message asking you to rebuild the index, then click on the ‘Rebuild Index’ button to complete the process.
Once it’s finished, WordPress will now include custom fields in its search results.
Besides that, SearchWP also offers other customization settings.
For instance, if you go to the ‘Settings’ tab, then you can add stopwords and synonyms that SearchWP should ignore during the search process to improve relevancy and performance.
The plugin already has a built-in list, but you can add more stopwords if you want. Similarly, you can add synonyms for search terms that you want to ignore while searching.
You can edit more settings by going to the ‘Advanced’ tab.
For example, the plugin lets you show partial matches when search terms show no result, limit results to exact matches when quotes are used, remove minimum word length, and more.
To help you fine-tune your website’s search, it’s a good idea to monitor how visitors are using the search feature. This allows you to see what’s working and what’s not working on your WordPress blog, so you can constantly improve your site’s search and help visitors find relevant results.
To see the search history and which queries your users search the most, simply head over to the ‘Statistics’ tab.
SearchWP will give all the stats about your WordPress search from the past 30 days or the last 1 year. This data can be particularly helpful for coming up with new content ideas.
We hope this article helped you learn how to make custom fields searchable in WordPress. You may also want to look at our guide on how to register a domain name and the best WordPress plugins for business sites.