How to Exclude Pages from WordPress Search Results?
Many times you might want to exclude pages from WordPress search results. For example, online stores might want to hide the checkout page, my account page, or a thank you page. On the other hand, membership sites might exclude custom posts or category pages from search results. In addition, some WordPress users prefer to exclude taxonomy and posts from some authors. Excluding certain pages from WordPress search results help to improve user experience and SEO ranking. Follow us and learn how to exclude pages from WordPress search results.
How to Exclude Pages from WordPress Search Results?
By default, WordPress search results show all posts, pages, and custom post types. Usually, it doesn’t impact websites’ SEO performance and visibility. But there are some pages on e-commerce websites that have no impact on search results, like content tables, checkout pages, etc.
To exclude pages from WordPress search results, you can use the SearchWP plugin. More than 30,000 websites use this tool to exclude posts, tags, taxonomy, etc.
SearchWP Features:
- It makes custom fields searchable that WordPress totally ignores.
- SearchWP’s Metrics Extension analyzes your search traffic, showing you what visitors are searching for.
- Integrate with your existing keyword search forms and result templates. No codes are required to change existing keyword forms.
- It integrates with your existing search results template and organizes results based on your chosen content and criteria.
- It is easy to set up and manage.
- Automatic integration with all WordPress themes.
SearchWP is a paid plugin available for $99, $199 and $399. You will also get a 100% money-back guarantee with the plugin.
Setup SearchWP WordPress Plugin
- Go to WordPress dashboard > Plugins > Add New > SearchWP > Install > Activation.
- After that, navigate to Settings > SearchWP and click on the License menu option. Insert your license key into the License box and click the Activate button.
- You can find the license details under your SearchWP account. Click on the Engines menu to set up your new WordPress search engine.
- Now, you will land on the page where you can configure your initial search engine settings. It is like setting up a Google search algorithm for your WordPress blog.
- Next, create the sitewide search engine before excluding pages from WordPress search results. Finally, click on the Posts, Pages, and custom post types dropdown menu to change the search engine settings.
- Every section has its weight multiplier that changes how the search engine will rank your website’s content.
- For instance, when you move the Content slider down, the title, post slug, and excerpt will hold more value. You can exclude pages, posts, and custom post types from appearing in the search here.
- Click on the Source & Settings button. This will bring up a popup where you can uncheck the Posts, Pages, and custom post types you have created.
- Finally, click on Done to exclude selected pages from WordPress search results.
- After you are done customizing the search engine settings, click the Save Engine button. Now, whenever people search on your Website, they will only view approved results.
How to Exclude Certain Pages, Posts, or Custom Post Types?
You need to use the Exclude UI extension from the SearchWP plugin to exclude specific content from WordPress search results. categories
The Exclude UI extension allows you to edit screens to exclude specific entries from the search with a tick.
- After logging into your SearchWP account, click on the Exclude UI download page to download the extension.
- After that, like the SearchWP plugin, install and activate the Exclude UI on your WordPress site.
- Now, open the page, post, or custom post type you want to remove from the search results.
- Suppose you want to exclude a single post from WordPress search results. In that case, ensure the Post option is selected and then check the Exclude from the search box.
- The process of excluding pages and custom post types is also the same. Again, ensure to hit the Update to save your changes.
How to Exclude Specific Categories, Tags, & Custom Taxonomies?
Before we tell you about excluding the categories, let us show you how to create categories & subcategories on WordPress website. You can exclude specific categories, tags, and taxonomies from search results using SearchWP.
- To do so, go to Settings > SearchWP > Edit Rules button in the Post section.
- A popup will appear on your screen to edit the search engine rules. Just click on the Add Rule button to create your rules.
- Select the Exclude entries from the dropdown menu and then enter the category name you want to exclude. You can enter custom taxonomies to exclude them. And click on the Done button.
- Similarly, select the Tags dropdown to exclude specific post tags from the search.
- In addition, you can add multiple rules following the same steps.
- Simply click on the Save Engines button to implement your search rules.
How to Exclude Particular Author Posts?
If you have multiple authors working on your site, you have two ways to exclude certain authors’ posts from the search.
If the author has a few posts, you can exclude their posts as per the process mentioned above.
Secondly, if several posts are published under the author’s name, you must add a code to exclude them.
You can add this code to your theme’s functions.php file or site-specific plugin using a code snippets plugin.
function wpb_search_filter( $query ) {
if ( $query->is_search && !is_admin() )
$query->set( 'author','-24' );
return $query;
}
add_filter( 'pre_get_posts', 'wpb_search_filter' );
In the code, replace 24 with the author’s user ID you want to exclude. To find the author’s user ID, go to Users > All users and hover the mouse over the user name.
You can use the same code to exclude multiple authors. All you need to do is separate their user IDs with a comma like this:
function wpb_search_filter( $query ) {
if ( $query->is_search && !is_admin() )
$query->set( 'author','-24, -12, -19' );
return $query;
}
add_filter( 'pre_get_posts', 'wpb_search_filter' );
Exclude Pages from WordPress Search Results
Whether your web pages are under construction or irrelevant to search engines, customizing your search results is a good practice. It lets you improve your SEO ranking and user experience in one go.
In addition, the SearchWP plugin can seamlessly exclude pages from WordPress search results. There is also an Exclude UI extension to optimize your search better.
For starters, you can get the basic SearchWP plugin for only $99. If the results are positive, you can upgrade to advanced versions.
I hope this article helped you exclude pages, posts, authors, and more from WordPress search results.
Leave a Reply