Are you wondering how to make WordPress search in post content?
It might be challenging for your site visitors to find what they’re looking for if you have a lot of posts and pages.
In this article, we’ll show you how to limit WordPress search to post content and how to make it consider post custom fields.
Why Make WordPress Search in Post Content
If you want to succeed online, 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. Since over 50% of web traffic comes precisely from this source, it’s essential to cover your audience’s needs.
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 part like content or title, helps solve this issue.
Now that we know why it’s important to search in post content, let’s look at how to do this below.
How to 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.
This plugin 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 many more.
Over 30,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 index 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 partial 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 here.
After that, 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.
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 site and install the plugin.
Need help on that? Feel free to check out the how to install a WordPress plugin step-by-step tutorial.
When you install the plugin, navigate to your WordPress site dashboard and click the SearchWP button at the top panel.
Once there, navigate to the License tab.
Paste the plugin license key you copied earlier into the License field and click Activate.
That’s it. You activated SearchWP, and now you’re ready to make WordPress search only for post content.
Step 2: Customize Your Search Engine
To begin with, go over to the Engines tab.
Here you’ll find the list of search engines you currently have.
Think of a search engine as a set of rules and conditions that WordPress considers while performing a search.
SearchWP 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.
By default, this search engine performs searches by 3 sources: posts, pages, and media.
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, press the Sources & Settings button.
Uncheck Pages and Media sources so that there will be only Posts left.
After that, press Done to save the changes.
Now, WordPress will only search by posts.
The next step is to change the set of post attributes that WordPress considers when searching.
You can think of attributes like a post’s parts. By default, there are 4 of them: title, content, slug, and excerpt.
To limit WordPress search for post content only, we need to remove all of the post attributes except Content.
To do so, press the Add/Remove attributes button.
Uncheck all the attributes except Content and then 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 WordPress will pay to an attribute when performing a search.
Let’s add relevance weight to the Content attribute by moving the slider all the way right. This way, WordPress will give the highest priority to this attribute when searching.
Here is how it looks on our test site:
Press the Save Engines button to save 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, press the Visit Site button under your site’s name at the top left of the WordPress dashboard.
We’ve 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.
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.
In this article, you learned how to make WordPress search in post content. It’ll allow you to deliver your visitors more relevant search results, making their user experience much better.
If you’re ready to gain full control over the search on your site, you can grab your copy of SearchWP here.
Would you like to create a custom search form? Check out this how to create a custom search form in WordPress guide with easy steps.
Do you want to put specific pages at the top of your site search results? Follow the how to prioritize specific search results in WordPress tutorial.