Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Exclude Pages from WordPress Search Results (Step by Step)

Do you want to learn how to exclude pages from the WordPress search results?

By default, the internal search on your WordPress site will include all posts and pages in the search results. To make it easier for your site visitors to find what they’re looking for, you may want to exclude certain content, so it never appears in those results.

In this article, we’ll show you how to exclude certain pages from the WordPress search results, step by step.

How to exclude pages from WordPress search results (step by step)

Why Exclude Pages from WordPress Search Results?

The default WordPress site search includes all of your posts, pages, and custom post types in the search results. This works well enough for many WordPress website owners.

However, if you’re running an online store, then you may want to hide pages like your account page, checkout page, thank you page, and more.

The same goes for those running membership websites or online courses. You may want to hide subscriber-only content from appearing in search.

With that said, let’s show you how to exclude pages from your sitewide WordPress search results.

Note: This guide covers on-site search results, when a visitor to your website uses a search box to search through your website content. If you’re looking to exclude pages from Google search results, then you should see our guide on how to hide a WordPress page from Google.

Create a New WordPress Search Algorithm with a WordPress Plugin

The easiest way to exclude pages from the WordPress search results is by using the SearchWP plugin. It’s the best search plugin for WordPress used by over 30,000 websites.

It’s very easy to use and gives you complete control of your WordPress search results.

First thing you need to do is install and activate the plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, navigate to Settings » SearchWP and then click the ‘License’ menu option.

Enter SearchWP license key

Then, you can enter your license key into the ‘License’ box and click the ‘Activate’ button. You can find this information in your account on the SearchWP website.

After that, you need to click on the ‘Engines’ menu option.

SearchWP default engine settings

This takes you to a page where you need to set your default search engine settings. Think of it like creating your own Google search algorithm that’s only for your website.

With SearchWP, you need to create a sitewide search engine before you can start excluding pages from the WordPress search results.

You can change the search engine settings by clicking on the ‘Posts’, ‘Pages’, ‘Media’, and other custom post type drop downs.

Each section has a weight multiplier that will change how the search engine ranks your website’s content.

For example, if you move the ‘Title’ slider down and the ‘Content’ slider up, then the content will hold more value than the title.

Customize search engine weight

You can also completely remove all pages from appearing in the WordPress search here.

Simply click the ‘Remove’ button in the ‘Pages’ section.

Click button to remove page source

This brings up a popup where you need to uncheck the ‘Pages’ box.

Then, click the ‘Done’ button to remove all pages from appearing in search.

Uncheck pages box and save

After you’re done customizing the default search engine settings, you need to click the ‘Save Engines’ button to create your first engine.

Save default SearchWP engine

Exclude Specific Pages From the WordPress Search Results

If you only want to exclude specific pages from the search results on your website, then this section is for you.

To do this, we’ll be using the Exclude UI extension from SearchWP. When you’re logged into your SearchWP account, go to the Exclude UI download page and click ‘Download Extension’.

SearchWP exclude UI extension

Then, install and activate the extension as you would any other WordPress plugin.

After that, open up the page that you want to exclude from the search results.

Next, make sure the ‘Page’ option is selected in your right hand menu, and simply check the ‘Exclude from search’ checkbox.

Exclude from search checkbox

Then click the ‘Update’ button, and that page will now be
hidden from the search results. Even if your visitors enter the exact title of the page into your search bar, it will not appear.

If you want to hide more individual pages from the search results, then simply follow the above steps again.

To exclude specific blog posts from WordPress search results, you can follow the same steps above. The only difference is that the right-hand menu will say ‘Post’ instead of ‘Page’.

We hope this article helped you learn how to exclude pages from the WordPress search results. You may also want to see our beginner’s guide on how to get a free SSL certificate for your website and our best business phone services for small businesses.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

37 CommentsLeave a Reply

  1. Thanks. This worked for me. I wanted to exclude gallery appears in search results and this code does exactly what I need. Thanks

  2. This is really basic. It would be nice to see how to exclude only particular page templates, or blog categories.

  3. Hello team WPBeginner

    I am facing a new problem

    when I have tested crawled pages on Google by writing

    site:example.com

    Then it showing pages & posts properly but also showing pagination links

    example.com/page/2/

    Like this

    So how can I avoid this?

    Please help me.

  4. Wondering if there’s a way to target different search forms with this technique. I’d like the main website search form to target pages only; and the blog search form to target posts only.

  5. I have some pages that are password protected (via main WP option to password protect a page) but they are still showing up in WP search with the excerpts. My understanding is that by default, the excerpts should not appear, you should see “There is no excerpt because this is a protected post.” I can use the Simply Exclude plugin but I’m wondering why the excerpts are showing up in the first place and I’d rather not add another plugin if I don’t have to.

  6. Thank you very much. You guys did the trick. I was looking for this and couldn’t find it anywhere else.
    Nice job, guys.

  7. When someone just hits SEARCH with the criteria being ‘blank’, ALL pages show up in the results. How can I have NO results show in this situation?

    • Noah, if you are saying about search result, you can validate the search form using javascript. So that people are forced to key in the words before do the searches.

  8. This worked great, thanks! How can I include WordPress Native BBPress forum topics in the search results?

    Thanks,

    L

  9. Hi! I would like to ask how do i exclude the specified pages i wanted to excluded from searches? And how do i know what is the ID of the page? Can someone tell a solution? I wanted to excluded some pages which are useless to visitors.

    Thank you!

  10. You are a real life saver. I tried codes from WordPress forum but didn’t work out. Yours is working for me! :D

  11. Can you alter this function to exclude specific pages/posts from search? Ive been searching for this functionality and havent found anything.

  12. Well, that’s almost perfect. I searched and found that many site’s offering us to hardcode the category ids to search id but this is cool. One question, i have to do the pagination myself so when i add this filter i won’t get offset issues .. right?

  13. Hi
    may I put your tutorials in my blog with a link to wpbeginner.com? my blog is in Farsi and I think many persian users need these tips.
    thanks a lot

  14. This hack excludes not only pages from search results, but also other custom post types. So if we have many custom post types in our WP site, we can put them in the statement like this:

    $query->set(‘post_type’, array(‘post’, ‘custom-post-type’));

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.