How to Exclude Pages from WordPress Search

By default, WordPress Search function shows revealed posts and revealed pages in seek effects. Often when customers are on the lookout for one thing in a weblog, it’s perhaps a put up quite than a web page. In this newsletter, we will be able to display you the way to make your seek extra related and not more crowded via with the exception of pages from WordPress seek effects.

First, you upload the next code to your theme’s purposes.php report or a site-specific plugin.

//Exclude pages from WordPress Search
if (!is_admin()) {
serve as wpb_search_filter($question) {
if ($query->is_search) {
$query->set('post_type', 'put up');
go back $question;

Explanation: This code first exams that the hunt isn’t originating from the WordPress admin pages. If it isn’t, then it searches for posts via surroundings the post_type parameter.

You too can make it do the other via surroundings the post_type to pages, so it simplest go back pages within the seek effects.

We hope this newsletter helped you find out how to exclude pages from WordPress seek effects. You may additionally need to see our listing of highest WordPress seek plugins to reinforce your website seek.

If you really liked this newsletter, then please subscribe to our YouTube Channel for WordPress video tutorials. You too can in finding us on Twitter and Facebook.

Recent Articles

The Best Pinterest Alternatives to Use if You are Bored of Pinterest

Pinterest is a loved social media network among the lover of aesthetics, mostly females tbh. Now, however more and more people are...

Ways you can add links to your Instagram post in 2021

Instagram has many cool features which need no introduction. However, there are a number of features that...

Finance App You should Have on Your iPhone and Android

We live in the age of digitization. When everything is digital, it is no surprise that money has joined the club too....

5 Video Editing Softwares to Try Your Hand at in 2021

Video is the king when it comes to social media. With reels dominating Instagram and Facebook and...

Charge Your Laptop Without a Charger in 5 Ways

Forgetting your laptop charger is a pretty common thing. We all have been there and all of...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here