How Do I Add a Sitemap XML to WordPress?

Adding a sitemap XML to WordPress is easy. Just add the following line to your theme’s functions.php file:

add_sitemap( ‘http://yourwebsite.com/sitemap.xml’ );

Once you add this line to your theme, you will need to create a sitemap.xml file.

Your sitemap.xml file should look something like this:.