5 Ways to Remove Pages from Your Sitemap in WordPress

Have you ever heard of Sitemap, XML Sitemap, or HTML Sitemap? These terms sound familiar to those who do SEO (Search Engine Optimization). However, they seem new to site owners who rarely work on optimizing their sites.

The sitemap remains critical to your site. Web crawlers like Googlebot read it to logically discover and index content on your site. It helps structure the website, makes navigating the site easier, and communicates with search engines.

For this reason, you would like as many pages on your site to be included in the map as possible. So why are you looking for ways to remove pages from your sitemap?

In this post, we will briefly explain what a sitemap is and why you need to exclude pages from your sitemap. Then 5 ways to remove WordPress pages from your sitemap will be brought to the table.

Let’s get started with the basics!

WordPress Sitemap, What is It?

Types of sitemaps

There are basically 2 types of sitemaps, XML and HTML. An XML Sitemap is technically a list of your web page URLs to tell Google and other search engines about the organization of your site content. Web crawlers will read this file to crawl your site more effectively.

Since HTML sitemap is designed for humans to read, it’s like a plain text version of the XML sitemap. Visitors can quickly navigate a website by reading your HTML sitemap.

What Do You Use WordPress XML Sitemap for?

XML sitemaps seem more important than HTML sitemaps since they target search engines and affect your site SEO rankings. While XML sitemaps don’t raise your rankings up, they help improve the crawling capability.

If there is a page on your site that is not indexed yet, then XML sitemaps will let search engines know about that page.

In case you use a lot of rich media such as videos and images on your WordPress site, XML sitemaps provide Google with this additional information.

When your site includes a lot of information and becomes larger, XML sitemaps help Google overlook and crawl your recently updated pages.

Web crawlers go through your site by following links from one page to another. They might miss one of your pages if there are no internal links leading to them.

Why It Matters Removing Pages from Sitemaps

One of the causes of excluding a URL from your sitemaps is to keep them clean. It’s not necessary to leave a broken page in your sitemap and let Google bot index and display it on search results. This page can cause various damages, from making your site lose brand value to affecting users’ experience.

What’s more, you should delete repetitive or fake links on your site from the sitemap otherwise they will damage the website’s SEO. There is no reason to keep duplicate content that might confuse visitors.

Certificate pages are another important case you need to pay attention to when it comes to taking out pages from your sitemap. Students won’t feel happy if they see their certificates show up on search results.

How to Remove Pages from Your WordPress XML Sitemap

You can apply 2 main ways to exclude pages from XML sitemaps, including using WordPress plugins and editing your .php files.

There are numerous plugins supporting sitemap page exclusion such as Yoast SEO, Google XML Sitemap, and All in One SEO Pack. Each provides a different method along with a set of benefits and shortcomings that can greatly affect your removal process down the road.

#1 Use Protect WordPress Pages & Posts Plugin

The first plugin you should try to exclude some of your pages and posts from the sitemap is Protect WordPress Pages & Posts (PPP).

It primarily comes as a content protection solution to shield your private and confidential pages and posts.

The plugin secures the post’s original URL by redirecting to a 404 page. At the same time, it creates protected links enabling only authorized users to access the content.

You are also able to remove protected content from the XML sitemaps with the plugin. As a result, they will no longer be indexed by Google and other search engines. to get started with the plugin, you need to:

  1. Download and activate the PPP plugin
  2. Visit the plugin settings page in your WordPress admin menu
    pda-protect-wp-pages-posts-plugin
  3. Decide the post types to protect
  4. Select the pages or posts you want to exclude from the sitemap
  5. Choose the places you intend to hide protected pages and posts from. It should be “Search results” in this case.

It’s possible for you to shield your content from other pages such as front pages or all the pages they are listed. Once saving changes, your protected page URLs will be automatically excluded from the XML sitemap.

#2 Exclude Pages or Posts from Sitemaps with Yoast Seo

Follow these 4 steps to remove post types from your sitemap using Yoast SEO plugin:

  1. Head to Add New under Plugin
    add-new-plugin
  2. Search for Yoast SEO then install and activate the plugin
    pda-install-yoast-seo
  3. Click on SEO on your left-hand side menu then choose Search Appearance
    pda-search-appearance
  4. Select “No” under the option “Show Pages in search results?” in the Content Types tab
    pda-yoast-no-show-pages-search-results

Bear in mind that this method enables you to remove all pages on your site instantly. Wish to remove specific pages only? Take the 3 steps below:

  1. Go to Pages or Posts sections and pick your desired page and post
    pda-pages-posts
  2. Find the Advanced option at the bottom of the page
  3. Click No under the question ‘Allow search engines to show this Page in search results?
    pda-yoast-remove-search-engines-metabox

#3 Remove Content from Sitemap Using Google XML Sitemap

This plugin allows you to take out pages by copying and pasting IDs of pages into the Excluded Items box.

  1. Install and activate the Google XML Sitemap plugin. You can reference how to install a plugin in the Yoast SEO part.
    pda-google-XML-sitemap
  2. Visit Pages or Posts.
    pda-pages-posts
  3. Hover the titles of the page or post you intend to remove from the site map and copy its ID
    pda-get-post-id
  4. Move to Settings and click XML-Sitemap

  5. Paste the page or post IDs in the Excluded Items box
    pda-excluded-items

#4 Use All in One SEO Pack Plugin

Though All in One SEO Pack offers various SEO features, we will focus on how it helps exclude an individual page from your sitemap.

  1. Install and activate the plugin
    pda-all-in-one-seo-pack
  2. Choose your desired page or post from the Pages and Posts sections in your admin sidebar
    pda-pages-posts
  3. Check the “Exclude from Sitemap” option at the bottom of the page
    pda-exclude-from-sitemap-all-in-one-seo

If you prefer visual instruction, the following tutorial video is for you!

#5 Use your functions.php file

Apart from plugins, you can also remove pages and posts from your sitemap using the functions.php file. Since this method can remove all your pages at once, you must be careful and remember to make a backup first.

  1. Find the functions.php file and open it
  2. Copy this code and paste it there
add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', function () {
  return array( 311, 322 );
} );

Pick the Right Solution for Your Sitemap Customization

Sitemaps play a key role in organizing your web page URLs which makes it easier for crawlers to find and index your WordPress pages and posts. A clean and well-managed sitemap will return good SEO results.

You should take broken page URLs, repetitive or fake links, and duplicate pages out of your sitemap otherwise they will destroy your site SEO effort.

Installing a plugin or Edit your.php files both help remove pages from your sitemap. They each come with their own set of benefits and shortcomings that can greatly affect your site.

While the former offers various options and allows you to quickly set up and get started, the latter forces you to backup your site before making any changes.

Which method do you prefer? leave your thoughts in the comment section below to let us know.