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 and keep visitors on your site for longer.
In this article, we’ll show you how to make custom fields searchable in WordPress.
What Are Custom Fields & Why Make Them Searchable?
By default WordPress adds metadata such as title, author, date, time, and more to your posts and pages.
WordPress custom fields allow you to store additional information about a post or page, in the form of metadata. You can then 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.
If you’re using WooCommerce, then some of your custom product attributes may also be classed as custom fields.
When a visitor uses a search bar on your website, WordPress will ignore all these custom fields and only show results where the title and content match the search terms.
By making your custom fields searchable you can help visitors find pages, posts, products, and other content on your WordPress website.
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 more.
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 start searching custom fields. In our images, we’re adding custom fields to the Posts section, 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.
To make all your custom fields searchable, select ‘Any Meta Key.’ 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 SearchWP should include, click on ‘Done.’
You’ll now see a ‘Custom Fields’ option in this section.
Each custom field has an ‘Applicable Attribute Relevance’ slider that 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’ll 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 your content.
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 start including custom fields in its search results.
How to Improve WordPress Search with SearchWP
This is a great start, but there are more ways to improve the built-in WordPress search.
For example, if you select the ‘Settings’ tab, then you can add stopwords and synonyms that SearchWP should ignore during the search process.
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 there are no exact matches, 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 what they’re looking for.
To see the search history and which queries your users search the most, simply head over to the ‘Statistics’ tab.
SearchWP will show detailed information from the past 30 days or the last 1 year. This data can even help you come up with new content ideas, by showing the topics that visitors are most interested in.
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 make money online blogging with WordPress and the best WordPress plugins for business sites.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Very informative post. Thanks for sharing post !
WPBeginner Support says
Glad our guide was helpful
Usama Sajjad says
Thanks, you are such a great team.
WPBeginner Support says
Glad you enjoy our content