How to generate an XML sitemap in WordPress?

by ervin.williamson , in category: SEO , 3 days ago

How to generate an XML sitemap in WordPress?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

by harrison.goodwin , 2 days ago

@ervin.williamson 

Generating an XML sitemap in WordPress is a straightforward process, and there are several ways to do it, either through plugins or using WordPress's built-in features. Here's how you can do it:

Option 1: Using a WordPress Plugin

There are several popular plugins that can automatically generate an XML sitemap for your WordPress site. Two commonly used plugins are:

Yoast SEO

  1. Install and Activate the Plugin: Go to your WordPress dashboard, navigate to Plugins > Add New, search for "Yoast SEO," install, and activate it.
  2. Enable XML Sitemaps: Go to SEO > General. Click on the Features tab. Find the XML sitemaps feature and ensure it is turned on. You can view your sitemap by clicking the question mark icon next to the feature and then selecting "See the XML Sitemap."

All in One SEO

  1. Install and Activate the Plugin: Navigate to Plugins > Add New, search for "All in One SEO," install, and activate it.
  2. Enable XML Sitemaps: Go to All in One SEO > Sitemaps. Ensure the Enable Sitemap option is activated. Customize your sitemap settings if needed and save changes.

Option 2: Using WordPress Built-In Feature

WordPress introduced a basic sitemap feature in version 5.5. This feature is enabled by default.

  1. Locate the Built-In Sitemap: Simply add /wp-sitemap.xml to the end of your site’s URL, e.g., https://yourwebsite.com/wp-sitemap.xml. This will display your site's XML sitemap.

Option 3: Custom Code

If you prefer to create a more customized sitemap without plugins, you might consider adding custom code to your theme's functions.php file or creating a custom plugin. This approach requires knowledge of PHP and WordPress hooks and is generally not recommended for beginners.

Important Considerations

  • SEO Plugins Compatibility: If you're using a dedicated SEO plugin, it’s usually best to stick with its sitemap feature as it offers more options and integration with other SEO tools.
  • Submit Your Sitemap: Once your sitemap is generated, ensure that you submit it to search engines like Google Search Console or Bing Webmaster Tools to help them crawl and index your site efficiently.


By following these steps, you can easily create and manage an XML sitemap for your WordPress website, aiding search engines in understanding and indexing your content.