5 Ways to Remove Pages from Your Sitemap in WordPress

Sitemaps refer to a list of URLs on your website. They help structure the sites and make site navigation easier. Web crawlers like Googe bot read this file to logically discover and index content on your site. As a result, you would like as many pages on your site to be included in the map as possible. So why do you have to remove pages from your sitemap?

In this post, we will explain what a sitemap is, why you need to exclude pages from your sitemap, and how to do so with ease. Let’s get started with the basics!

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 pages URLs to tell Google and other search engines about the organization of your site content. Web crawlers will read this file to more effectively crawl your site.

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 XML sitemap for?

XML sitemaps seem more important than HTML sitemaps since they target to 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 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 crawl your site by following links from one page to another. They might miss one of your pages if no backlinks leading to them.

Why it matters to remove pages from sitemaps

One of the reasons to exclude a URL from your sitemaps is to keep sitemaps 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 lowing down users’ experience.

You can apply 2 ways to remove pages from XML sitemaps, either using WordPress plugins or editing your .php files. There are numerous plugins supporting sitemap pages exclusion you can try such as Protect WordPress Pages and Posts, Yoast SEO, Google XML Sitemap, and All in One SEO Pack.

#1 Use Protect WordPress Pages & Posts to remove pages and posts from sitemap

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.

You are also to remove protected content from the XML sitemaps. As a result, they won’t be indexed by Google and other search engines anymore. 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 plugin

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 pages from sitemaps using Google XML Sitemap plugin

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 to Remove Your Pages from Sitemaps

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

#5 Use your functions.php file

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

  1. Find the functions.php file and open it
  2. Copy this code and paste 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. A clean and well-managed sitemap will return good SEO results.

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

Leave your comment below if you have any questions about how to exclude pages from your WordPress sitemap.