Looking for a way to include ACF fields in WordPress search?
By making data in custom fields searchable on your site, you give your visitors a new way to search for content and help them to get more relevant search results.
In this step-by-step guide, we’ll talk about how you can include ACF fields into search results on your site with no coding needed.
Why Include ACF Fields in WordPress Search
ACF, or Advanced Custom Fields, is one of the most popular WordPress plugins for managing custom fields on your site.
With it, you can easily create and set up custom fields for your posts, users, taxonomy terms, and media.
Making these fields searchable on your site will make it easier for visitors to find the desired content since they usually contain a lot of valuable data.
For example, you can put in custom fields such information as content type, collection, or anything else you want to specify.
With that, let’s see how you can make ACF fields searchable on your site in a few clicks, even if you’re a complete WordPress beginner.
How to Make ACF Fields Searchable on Your Site
The easiest way to include ACF fields in search results on your site is to use the SearchWP plugin.
This is the best WordPress search plugin that allows you to drastically enhance search on your site.
In addition to ACF fields, you can also use SearchWP to make any post custom fields, attributes, or taxonomies searchable.
And this is just one of the many SearchWP features that will help you grow your business.
For example, you can use this plugin to track your visitors’ searches, limit search to specific post types and categories, change the order of search results, and much more.
Over 30,000 WordPress website owners use SearchWP to deliver their visitors the most relevant search results.
Here are some other amazing things you can do with this plugin:
- Turn on fuzzy search. Make WordPress search for partial matches in case there are no exact ones to keep your visitors from leaving your site unsatisfied.
- Exclude specific pages from search results. Get rid of redundant pages in your search results to make it easier for visitors to find the right content.
- Enable search for PDF files. Make PDFs and office document files searchable on your site so visitors can quickly find them using a search bar.
- Add search by categories. Allow your visitors to choose in which category they want to search for content to give the most relevant search results.
After you’ve learned why using the SearchWP plugin is the best way to include ACF fields in search results on your site, let’s take a step-by-step look at how you can do it.
Step 1: Install and Activate SearchWP on Your Site
The first thing you need to do is to grab your copy of SearchWP.
Then, navigate to your SearchWP account and click Downloads.
Next, press the Download SearchWP button to start downloading the plugin’s ZIP file to your computer.
Once the download is finished, copy your SearchWP license key on the same tab.
The next step is to install and activate SearchWP on your site. You can follow the step-by-step instructions on how to install a WordPress plugin if you need a refresher on how to do that.
After you install SearchWP on your site, you’ll also need to activate it with your license key.
The fastest way to do that is to point your cursor over the SearchWP button at the top of your WordPress dashboard and click Activate License.
Next, insert your license key into the License field and press Activate.
After you activate SearchWP on your site, you’re ready to enable search by ACF fields on your site.
Step 2: Start Customizing Your Search Engine
To get started, click on the Engines tab in your SearchWP settings.
On this tab, you can see your search engines created with SearchWP.
You can think of a search engine as a set of rules that WordPress sticks to when performing searches.
By editing them, you can customize how search works on your site.
For example, you can control where WordPress searches for matches, manage the relevance weights of various attributes, exclude specific categories from search results, and more.
There is currently only one search engine called Default. It’s linked to every search field that exists on your site.
But, SearchWP allows you to add an unlimited number of search engines and link them to individual search forms.
This way, you can create fully customized search forms and place them anywhere across your site.
Since we want to make custom ACF fields searchable throughout the site in this tutorial, we’ll configure the Default search engine.
Step 3: Make ACF Fields Searchable
To get started, select the type of content you want to make searchable by ACF fields among the Default search engine search sources.
It can be the Posts, Pages, or Media sources.
For example, on our test site, we added an ACF field called Reading time and want to make it searchable for posts.
So, we’ll click on the Posts search source.
Next, press the Add/Remove Attributes button.
In the appeared window, you can manage the Posts search source attributes.
To include ACF fields in your site search, first click the Custom Fields field.
Then, choose the ACF field you want to make searchable from the drop-down menu.
There is also a way to automatically make any custom fields, including ACF fields, searchable on your site.
To do that, choose the Any Meta Key option.
When you’re finished managing the Posts search source attributes, press Done to save your changes.
The last step is to save the changes you made to the Default search engine. You can do that by pressing the Save Engines button at the top right corner of your SearchWP dashboard.
Then, click the Rebuild Index button next to it. It’ll make WordPress to reindex all your posts and check if they have any custom fields.
After you’ve enabled ACF field search on your site, let’s test your new search.
Step 4: Test Your New Search
To do that, go to your site and search for any content placed within the ACF field you made searchable on your site in the previous step.
For example, on our test site, we included a custom field called Reading Time in the search.
Let’s try to find a post named “The 10 Best WordPress Analytics Plugin” that takes 15 minutes to read.
We found the post, even though it only has the phrase “15 minutes” in the custom field created with the ACF fields plugin.
From this guide, you learned how to include ACF fields in WordPress search. It’ll help your visitors faster find the right content and improve their user experience.
Ready to make ACF fields searchable on your site? You can get started with SearchWP here.
Want to add a search by post tags to your site? Follow our how to search posts by tags in WordPress step-by-step tutorial.
Wonder how to put a search bar to your pages with a shortcode? Check out this how to add a WordPress search bar with a shortcode guide.