• Resolved ctmartin2020

    (@ctmartin2020)


    I need to add custom sitemaps to the sitemap.xml. I found this code (below) but this is not working. What do I need to do to add additional custom XML sitemaps to the set?

    Here is the code I had found but is not working…

    function addCustomSitemap($gsg) {
    	$sitemap = new GoogleSitemapGeneratorSitemapEntry('my-sitemap.xml');
    	$gsg->AddElement($sitemap);
    }
    
    add_action(‘sm_build_index’, ‘addCustomSitemap’, 100, 1);
    • This topic was modified 3 years, 5 months ago by ctmartin2020.
Viewing 1 replies (of 1 total)
  • Thread Starter ctmartin2020

    (@ctmartin2020)

    Disregard! IT DOES WORK. Just realized I had copy-pasted this code from elsewhere and it included “fancy” quotes in the add_action function call… can’t have those! So for those who may come across this post — DO NOT COPY-PASTE my code above. Instead, use this:

    function addCustomSitemap($gsg) {
    	$sitemap = new GoogleSitemapGeneratorSitemapEntry('my-sitemap.xml');
    	$gsg->AddElement($sitemap);
    }
    
    add_action('sm_build_index', 'addCustomSitemap', 100, 1);
Viewing 1 replies (of 1 total)
  • The topic ‘Add custom sitemap?’ is closed to new replies.