Create a sitemap using custom code
Here’s how you create a sitemap using custom code without plugins. All you have to do is add our custom code to your theme functions, and it will auto-generate the sitemap.
This code will auto-generate a sitemap for your website. However, if you are using a plugin like Yoast, it will automatically generate a sitemap, and in that case it is not recommended to use the codes to generate another sitemap.
Anyway, if everything is placed properly, you should find the sitemap at yoursiteurl/sitemap.xml. Do give it a try. Thank you very much!
Create a sitemap using custom code
Enable the Classic Editor on WordPress using Custom codes!
Publishing failed. The response is not a valid JSON response