How to Exclude A Page From the Sitemap In WordPress?

14 minutes read

To exclude a page from the sitemap in WordPress, you can manually modify the code in your theme's functions.php file. Here's how you can do it:

  1. Access your WordPress dashboard and navigate to "Appearance" -> "Theme Editor."
  2. On the right-hand side, you'll see a list of theme files. Locate and select the "functions.php" file.
  3. Inside the functions.php file, add the following code snippet:
1
2
3
4
5
function exclude_page_from_sitemap($excluded_pages) {
    $excluded_pages[] = get_page_by_title('Page Title')->ID;
    return $excluded_pages;
}
add_filter('wpseo_sitemap_exclude_pages', 'exclude_page_from_sitemap');


  1. Replace 'Page Title' with the title of the page you want to exclude. For example, if your page's title is "Contact," the code will be:
1
$excluded_pages[] = get_page_by_title('Contact')->ID;


  1. Click the "Update File" button to save your changes.


After adding this code, the specified page will be excluded from your WordPress site's XML sitemap. This ensures that search engines won't index or include it in their search results.

Best WordPress Books of April 2024

1
WordPress: The Missing Manual: The Book That Should Have Been in the Box

Rating is 5 out of 5

WordPress: The Missing Manual: The Book That Should Have Been in the Box

2
WordPress All-in-One For Dummies (For Dummies (Computer/Tech))

Rating is 4.9 out of 5

WordPress All-in-One For Dummies (For Dummies (Computer/Tech))

3
WordPress Explained: Your Step-by-Step Guide to WordPress (2020 Edition)

Rating is 4.7 out of 5

WordPress Explained: Your Step-by-Step Guide to WordPress (2020 Edition)

4
Professional WordPress: Design and Development

Rating is 4.5 out of 5

Professional WordPress: Design and Development

5
WordPress Plugin Development Cookbook: Create powerful plugins to extend the world's most popular CMS, 2nd Edition

Rating is 4.4 out of 5

WordPress Plugin Development Cookbook: Create powerful plugins to extend the world's most popular CMS, 2nd Edition

6
WordPress 5 Complete: Build beautiful and feature-rich websites from scratch, 7th Edition

Rating is 4.3 out of 5

WordPress 5 Complete: Build beautiful and feature-rich websites from scratch, 7th Edition

7
Building Web Apps with WordPress: WordPress as an Application Framework

Rating is 4.2 out of 5

Building Web Apps with WordPress: WordPress as an Application Framework

8
WordPress for Beginners 2020: A Visual Step-by-Step Guide to Mastering WordPress (Webmaster Series)

Rating is 4 out of 5

WordPress for Beginners 2020: A Visual Step-by-Step Guide to Mastering WordPress (Webmaster Series)


What is the Yoast SEO plugin in WordPress?

The Yoast SEO plugin is a popular tool used in WordPress to optimize websites for search engines. It provides various features and functionalities to improve the website's search engine visibility and rankings. The plugin helps users optimize their content and meta tags, generate XML sitemaps, analyze readability and keyword usage, manage social media optimization, and much more. It offers both free and premium versions, making it a valuable tool for WordPress users looking to improve their website's SEO performance.


How to add a video sitemap in WordPress to exclude specific video pages?

To add a video sitemap in WordPress and exclude specific video pages, you can follow these steps:

  1. Install and activate a WordPress SEO plugin like Yoast SEO or All in One SEO Pack. These plugins provide the necessary functionality to generate a video sitemap.
  2. Once activated, go to the plugin's settings page in your WordPress admin dashboard. Look for the "XML Sitemaps" section.
  3. Enable the option to generate an XML sitemap for videos. This option might be named differently depending on the plugin you are using.
  4. Configure the video sitemap settings. You can usually find options to include/exclude certain content types or taxonomies. Look for a settings option that allows you to exclude specific video pages, such as by URL or post ID.
  5. Enter the URLs or post IDs of the video pages you want to exclude from the sitemap. These could be individual video posts, pages, or custom post types.
  6. Save your changes and regenerate/update the XML sitemap. Most SEO plugins provide a button or option to manually regenerate the sitemap.
  7. Verify that the excluded video pages are not present in the newly generated sitemap. You can typically view and download the sitemap from the plugin's settings page or by appending /sitemap.xml to your website's URL.


By following these steps, you can have a video sitemap in WordPress that excludes specific video pages from being included.


What is the purpose of a sitemap in WordPress?

The purpose of a sitemap in WordPress is to help search engines understand the structure and organization of a website. It is essentially a list of all the pages, posts, and other content on the website, arranged hierarchically in a way that makes it easy for search engines to crawl and index the site. This helps improve the website's visibility and SEO (Search Engine Optimization) by ensuring that all the pages are accurately indexed. Additionally, a sitemap can also benefit website visitors by providing a clear and accessible overview of the site's structure, making it easier for them to navigate and find the content they are looking for.

Best WordPress Hosting Providers in 2024

1
Vultr

Rating is 5 out of 5

Vultr

  • Ultra-fast Intel Core
  • High Performance and Cheap Cloud Dedicated Servers
  • 1 click install Wordpress
  • Low Price and High Quality
2
Digital Ocean

Rating is 4.9 out of 5

Digital Ocean

  • Active Digital Community
  • Simple Control Panel
  • Starting from 5$ per month


How to improve SEO with a sitemap in WordPress?

To improve SEO with a sitemap in WordPress, you can follow these steps:

  1. Install and activate an SEO plugin: Use a popular SEO plugin such as Yoast SEO or All in One SEO Pack.
  2. Generate an XML sitemap: Once the plugin is activated, go to its settings and find the option to generate an XML sitemap. Enable the feature and save the settings.
  3. Customize your sitemap: Configure the sitemap settings to include the desired content types, taxonomies, and post statuses. You can typically find these options in the plugin's settings or in the XML sitemap settings.
  4. Submit your sitemap to search engines: Most SEO plugins will provide an option to submit your sitemap to search engines. Locate this feature and follow the prompts to submit your sitemap to major search engines like Google, Bing, and others.
  5. Enable sitemap indexing: Ensure that search engines can discover and crawl your sitemap by checking your website's robots.txt file. This file should allow search engines to access and index your sitemap.
  6. Regularly update your sitemap: Whenever you create new content, make sure to update your sitemap. Most SEO plugins will automatically do this for you, but it's always a good idea to double-check.
  7. Monitor your sitemap status: Periodically check the SEO plugin dashboard to ensure your sitemap is functioning properly and being indexed by search engines. This will help you identify any potential issues or errors.
  8. Monitor search console: Keep an eye on your website's performance and index status through Google Search Console or other similar tools. This will give you insights into the visibility of your sitemap and any potential SEO improvements needed.


By incorporating these practices, you can improve the SEO performance of your WordPress website through the effective use of a sitemap.


How to exclude a specific tag archive page from the sitemap in WordPress?

To exclude a specific tag archive page from the sitemap in WordPress, you can use the Yoast SEO plugin. Here's how you can do it:

  1. Install and activate the Yoast SEO plugin (if you haven't already) from the WordPress plugin repository.
  2. Go to the Yoast SEO settings by navigating to SEO → General in the WordPress admin dashboard.
  3. Click on the "Features" tab within the Yoast SEO settings.
  4. Scroll down to the "Advanced settings pages" section, where you will find a list of different options.
  5. Look for the "Tags" option and enable it by clicking the switch next to it.
  6. Once enabled, go to the "SEO → Titles & Metas" section in the WordPress admin dashboard.
  7. Click on the "Taxonomies" tab within the Titles & Metas settings.
  8. In this section, you will see all the taxonomies available in your WordPress installation.
  9. Locate the "Tags" option and click on it to expand the settings.
  10. Scroll down until you find the "Enable Sitemap" option for tags and disable it by clicking the switch next to it.
  11. Save your changes.


By following these steps, you have excluded the specific tag archive pages from the sitemap generated by the Yoast SEO plugin.


What is the default behavior of page inclusion in the sitemap in WordPress?

In WordPress, by default, the pages that have been published will be automatically included in the sitemap. This is made possible by the built-in XML sitemap functionality introduced in WordPress version 5.5. The sitemap is automatically generated and updated whenever a new page is published or an existing page is modified. However, it is important to note that the visibility and indexability settings for individual pages can affect their inclusion in the sitemap. If a page is set to private or if the search engines are instructed not to index it, it may not be included in the sitemap.


What is the impact of excluding a page from the sitemap on user experience in WordPress?

Excluding a page from the sitemap in WordPress can have various impacts on user experience, depending on the nature of the excluded page and how users interact with it. Here are a few possible impacts:

  1. Discoverability: The sitemap is used by search engines to discover and index web pages. If a page is excluded from the sitemap, it is less likely to be quickly indexed by search engines. This means users may have difficulty finding the page through search engine results, potentially reducing its visibility and accessibility.
  2. Navigation: Sitemaps often serve as a navigational aid, helping users find and explore different sections of a website. If a page is excluded from the sitemap, it may not be easily discoverable through the website's navigation menus or related pages. Users may have to rely on other means (e.g., direct links, search functionality) to access the excluded page, resulting in a less seamless navigation experience.
  3. Content hierarchy: Sitemaps typically reflect the hierarchical structure of a website, showcasing the organization and relationships between different pages. Excluding a page from the sitemap might disrupt this hierarchy, potentially causing confusion or disorientation for users who expect a certain logical flow or structure within the website's content.
  4. Site updates: If a page is excluded from the sitemap, it might not be automatically included when the sitemap is regenerated or updated. As a result, any changes or updates made to the excluded page may not be reflected in the sitemap, potentially causing discrepancies between what users expect to find and what is actually visible in the sitemap.


Overall, excluding a page from the sitemap can have negative impacts on user experience by reducing discoverability, navigation ease, content hierarchy, and synchronization between the sitemap and actual website content. However, the specific impact will vary depending on the specific page and how it fits into the overall website structure.

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

Related Posts:

Those who’ve been using Yoast’s WordPress SEO and/or a separate XML Sitemap plugin, might have came across this strange warning: The following plugins might cause (xml sitemaps) issues with Yoast WordPress SEO: Google XML Sitemaps. You see this error when y...
An XML Sitemap provides you the way to let search engines crawl and index the new URLs on your website. With static websites, you need to generate and change the sitemap again-and-again manually to include new URLs within it. But if you use WordPress, you don’...
To check if a page is the cart page in Shopify, you can use liquid code to compare the current URL with the cart page URL. First, get the current URL using the {{ request.url }} object. Then, use an if statement to compare it with the URL of the cart page, whi...