One of the most common questions we get from WordPress users is how to make their site search more accurate.
It might be challenging for your site visitors to find what they’re looking for if you have a lot of posts.
The default WordPress search has limited capabilities. It would ignore important information that might be present in custom fields, categories, or tags. As a result, showing irrelevant search results.
In this article, we’ll show you how to limit WordPress search to post content.
Why Make WordPress Search in Post Content
If you want to succeed online, then it’s important to ensure that your site visitors can quickly find what they’re looking for.
A positive user experience makes them discover more of your content, return to your site over again, and even share a link to it on social media.
On top of that, the satisfaction of your visitors directly affects the ranking of your site in search engines.
One of the best ways to give your visitors more relevant search results is to limit searches to a certain type of content.
The thing is, by default, WordPress searches for title, content, and excerpt of posts and pages. Due to that, there is usually a lot of clutter in the search results, making it much more difficult to find the right content.
Limiting search only to posts, or even to a specific attribute like content or title, helps solve this issue.
That said, let’s look at how you can make WordPress search in post content.
Make WordPress Search in Post Content
The fastest and most convenient way to make WordPress search in post content is to use a plugin like SearchWP.
It is the best WordPress search plugin that allows you to get complete control over how search works on your site.
Using it, you can make searchable anything on your site, create custom search fields, track searches, and more.
Over 50,000 WordPress site owners already use SearchWP to give their visitors the most relevant search results.
SearchWP also helps you:
- Display Search Results in Live Mode: Want to instantly display search results on your site? Using SearchWP, you can do that with just a few clicks.
- Make WordPress Search PDF Files: Do you upload any PDFs to your site? With SearchWP, you can make the content within them searchable, enriching your site’s search results.
- Exclude Pages from Search Results: Want to exclude specific pages from search results on your site? SearchWP allows you to do that in just a few clicks.
- Enable Fuzzy Search: Do you want to make WordPress search for fuzzy matches if there are no exact ones? Using SearchWP, you can turn on fuzzy search, so your visitors can find more results.
Now, let’s take a look at how to limit WordPress search to post content only using SearchWP.
Step 1: Install and Activate SearchWP
The first step is to grab your copy of SearchWP by visiting the website and creating a new account.
After that, you can navigate to your SearchWP account and go over to the Downloads tab. Then click Download SearchWP to start downloading the plugin’s ZIP file to your computer.
You should also copy the SearchWP license key at the same tab, as you’ll need it further to activate the plugin.
Once the download is finished, the next step is to upload the SearchWP ZIP file to your WordPress site and install the plugin.
If you need help with this, then feel free to check out the how to install a WordPress plugin step-by-step tutorial.
Upon activation, you will see the onboarding wizard for SearchWP. Simply click the ‘Start Onboarding Wizard’ button and follow the onscreen instructions to set up the plugin.
That’s it. You have successfully activated SearchWP, and now you’re ready to make WordPress search only for post content.
Step 2: Customize Your Search Engine
To begin, you can customize the default search engine or create a new one using SearchWP.
Think of a search engine as a set of rules and conditions that SearchWP considers while performing a search. It also allows you to add and use multiple search engines with different sets of settings.
Right now, there is only one search engine called Default. WordPress uses it for native searches. By customizing it, you can edit how search works across your entire site.
Since we want to limit WordPress search only by post content, the first step is to remove all the sources except Posts.
To do so, you can head to SearchWP » Algorithm from the WordPress dashboard and press the Sources & Settings button.
Next, a new window will open where you can select different sources for the engine.
Go ahead and uncheck Pages and Media sources, so that there will be only Posts left.
After that, simply click the Done button to save the changes.
The next step is to change the set of post attributes that SearchWP considers when searching.
Attributes are the fields you want to search for a given source, like title, content, excerpt, slug, custom fields, taxonomy terms, and more. This decides which content details to consider when your site is looking for results.
By default, 5 attributes will be selected, which includes title, content, slug, excerpt, and author. To limit WordPress search for post content only, you can remove all the post attributes except Content.
To do so, first press the Add/Remove attributes button.
Go ahead and uncheck all the attributes except Content.
From here, press Done to save the changes.
You can also change the relevance weight of attributes by moving the slider next to them left or right.
The bigger the weight, the more attention SearchWP will pay to an attribute when performing a search.
Finally, you can press the Save button to store the changes when you’re finished.
That’s it. You’ve just made WordPress search for post content only.
Step 3: Test Your New Search
The next step is to try out your new search engine.
To do so, simply visit your website and head to the search form or search bar.
For instance, we added a post on our test site containing the word “Apple” in the content and “Orange” in the title.
First, let’s see if we find this post by the Apple search term.
As you can see, we were able to find the post because WordPress considers the post content and gives it the highest priority.
Now, let’s see if we can find it by the title, which is Orange.
There is nothing found. It means that our WordPress site now considers only the content of posts when searching, ignoring everything else.
Bonus: How to Make WordPress Consider Post Custom Fields
Would you like to make your WordPress site consider post custom fields when searching?
Custom fields are the fields where you can put any additional information about the post. For example, you can specify its type, author, time to read, or anything else.
Making this data searchable is a great way to give your visitors more relevant search results.
With SearchWP, you can make post custom fields searchable in just a couple of clicks.
For more details, follow the how to add custom fields search in WordPress tutorial.
We hope this article helped you learn how to make WordPress search in post content. You may also want to see how to create a custom search form in WordPress and how to prioritize specific search results in WordPress.
Ready to create a better and more personalized WordPress search experience? Get started with SearchWP today!