By default, WordPress Search function shows revealed posts and revealed pages in search results. Usually when customers are on the lookout for one thing in a weblog, it’s more than likely a publish somewhat than a web page. On this article, we’ll present you make your search extra related and fewer crowded by excluding pages from WordPress search results.
First, you add the next code to your theme’s features.php file or a site-specific plugin.
Clarification: This code first checks that the search just isn’t originating from the WordPress admin pages. If it isn’t, then it searches for posts by setting the post_type parameter.
You can too make it do the alternative by setting the post_type to pages, so it solely return pages within the search results.
You May Also Like : Making Your WordPress Mobile Friendly with WPtouch Pro
We hope this text helped you discover ways to exclude pages from WordPress search results. You might also wish to see our checklist of greatest WordPress search plugins to enhance your website search.
If you liked this article, make sure to hit the bell for getting our latest updates and share this article with your friends in every social media platforms.