WordPress core offers many default functions and one of the useful functions is the search function. You can use the search function to get the exactly desired post or page quickly. However, certain times it will create problems that Google will start indexing your internal search pages and show then in search results. In this case, have to tell Google noindex the search pages. In addition, you can also disable search in WordPress temporarily or permanently to protect your site from spammers.
Using WordPress Search Function
There are many ways to use the search function in WordPress.
- WordPress offers a search widget that you can place anywhere on your site. This will allow frontend users to search and get the results.
- You can insert the Search block inside post content when using Gutenberg editor.
- Depending upon your theme, you can add on the search box in the header or footer or any other area.
- There is also a search option in the top admin bar when you view the posts by logging into site.
Problems with WordPress Search Function
Whatever the above option you use, the search function work similarly on the backend. Anyone can send automated search queries to your site without using the search box at all. Below are two of the ways a spammer can send automated search queries to your site.
Why Automated Search Queries are Problem?
The problem comes when Google try index your internal search pages that includes automated junk queries. First, internal search queries are not useful for indexing in search result pages. In addition, indexing spam search pages will affect the authority of your site and impact the ranking. You can go to Google Search Console and check the indexed pages under “Coverage” section. In our case, we noticed all internal search pages are under “Excluded” section with the classification as “Crawled – currently not indexed”.
Make sure to check all categories under error, valid, valid with errors and excluded sections to find the internal search pages on your site.
Handling Internal Search in WordPress
You have to take immediate action when you find internal search pages under “Coverage > Valid” section. Because the valid pages will show in search results and create bad user experience when users landing on these pages. There are few ways to handle the internal search pages showing in Google search results.
1. Noindexing Internal Search Pages
If the internal search pages what you see in Google Search Console are legitimate then we recommend you simply noindex all these pages. Generally, there will be a smaller number of users using the search box on any website (unless you have a large search based website). Therefore, you can ignore the volume of pages and tell Google not to index them. The legitimate pages will have one or few meaningful keywords while automated searches will have junk lengthy content.
- Real user search – yoursite.com/?s=wordpress+theme
- Fake bot search – yoursite.com/search/big-junk-content
It is also easy to identity the fake searches if they are in different language than your content. For example, you have an English site but you see repeated queries in Chinese, Korean or Russian language.
Now, the problem here is that these pages are dynamic and you will never know the search query users will use on your site. Fortunately, there is a solution with the most popular SEO plugin for WordPress – Yoast SEO. It automatically add meta robots tags to all your internal search pages with the below entry. This will help to instruct Google to ignore the internal search pages while allowing all search engine robots to follow the pages. As you see in the above Google Search Console screenshot in our case, all URLs are under noindex category. This is because we use Yoast SEO Premium on this website.
You can use any other WordPress plugin that automatically noindex your internal search pages to stop showing them in public search result pages.
2. Permanently Disabling WordPress Search
If you have hundreds of thousands of automated searches in Google Search Console, then it makes sense to stop the search permanently. This will help you to completely get rid of all the entries in Search Console. You can disable WordPress search by using “Disable Search” plugin on your site.
- Go to “Plugins > Add New” section on your site and search for “disable search” plugin.
- Install and activate the plugin on your site.
- That’s it!!! The plugin will disable all frontend search on your site
Remember, this will not remove the search boxes you have placed but redirect all internal searches to your default 404 page.
3. Using Google Search
Instead of using WordPress search function, you can try Google’s custom search engine option. You can also monetize the search results similar to Google search, if you are using AdSense. You can create custom search box from AdSense account and place code anywhere on your site. Check out our article on how to add custom search in WordPress site for getting step by step process of integrating the search box.
Automated bots can also send queries with Google search box like yoursitename.com/q=query. However, you do not need to worry much as Google will block them by showing I’m not robot captcha code.
4. Blocking IP Address
The other alternate option is to block the originating IP address of the automated query. You can check our article on how to find the spam IP addresses and block them accessing your site. However, this is useful only when you receive spam automated searches from few IP addresses. This will not be useful when your site receives automated searches from bunch of different IPs.
Sometimes useful functions like WordPress search can create unexpected problems. When internal search pages are getting indexed, you have to take action to noindex or disable the search function. Alternatively, use custom search engine other than default WordPress search function to protect your site from automated spams.