There are a number of ways that we can create xml sitemap in WordPress. We will use the yoast seo plugin to achieve this.
We use this plugin because it allows us to optimize our blog posts along with offering other features such as sitemaps, social integration, and more. We have also noticed that it works more efficiently than other standalone sitemap generators for WordPress.
To add a sitemap to your WordPress site, first thing you need to do is install and activate WordPress SEO by Yoast plugin. By default, WordPress SEO does not enable XML sitemap functionality, so you will have to turn it on. To do that go to SEO » XML Sitemaps and check the box to enable XML sitemap functionality.
When you check the box to enable XML sitemap functionality, WordPress SEO will show you a number of options that you can configure for your Sitemaps. If you are unsure about what to do with them, then ignore them and click on Save settings.
Now your sitemaps are generated and publicly accessible. WordPress SEO will show a XML Sitemap button which you can click to view your sitemap_index.xml sitemap.