This is a quick guide to help you create a WordPress Sitemap without using a plugin.
Firstly, why would you want to not use any third party plugins to create a sitemap? It’s really simple. All WordPress websites should look to maintain a fully functioning site with somewhere around ~10 front facing plugins. For reasons such as speed, flexibility, security and compatibility. Some plugins which are not secure can leave your website vulnerable, they can also be incompatible with other plugins resulting in your website not loading and producing errors, and the third reason because of speed, some plugins are bulky and overloaded with code.
Create WordPress Sitemap without Plugin
Before you start – You need to have administrative access to your WordPress site and FTP access. You should also always take a full database and theme file backup before making any changes.
Step 1: Go to your theme folder
Step 2: Create and name a file page-sitemap.php
Step 3: Paste the code below into the page-sitemap.php file
Step 4: Create a new page in the backend of your WordPress install. Select the page template “Sitemap”
Step 5: Now tweak to fit your site
WordPress Sitemap Page Code – Type 1
This is the original sitemap file. This supports posts, pages and WooCommerce products. If you don’t want or need WooCommerce products support then just delete the div classed ‘sitemap-loop-c’.
WordPress Sitemap Page Code – Type 2
I have added a second type of sitemap. Try both and see which you prefer. The one below supports posts, pages, and custom post types.