• Resolved delbono72

    (@delbono72)


    Hello
    I created custom urls that are not included in sitemap.
    How can I add urls programmatically?

    I tried

    private function addUrlsToSitemap($linkUrls){
        
        require_once('wp-content/plugins/google-sitemap-generator/sitemap-loader.php');    
        require_once('wp-content/plugins/google-sitemap-generator/sitemap.php');        
            
        $googleSitemapGeneratorLoader = new GoogleSitemapGeneratorLoader();
        $googleSitemapGeneratorLoader->LoadPlugin();        
    
        if(class_exists('GoogleSitemapGeneratorPage')){    
    
            $priority = '0.5';
            $changeFreq = 'weekly';
            $lastMod = time();
                
             foreach ($linkUrls as $key=>$linkUrl) {     
    
                         $pages[] = new GoogleSitemapGeneratorPage($loc, $priority, $changeFreq, $lastMod, null);    
             }
            
            
            
            $sg = GoogleSitemapGenerator::GetInstance();
    
            $sg->SetPages($pages);
            $sg->SavePages();
            
            return;
        }  
    
      }

    But urls aren’t saved.
    I’m afraid I am missing one last step.

    • This topic was modified 3 years, 2 months ago by delbono72.
    • This topic was modified 3 years, 2 months ago by delbono72.
    • This topic was modified 3 years, 2 months ago by delbono72.
Viewing 1 replies (of 1 total)
  • Plugin Author xmlsitemapgenerator

    (@xmlsitemapgenerator)

    Sorry. This is not a supported feature with our plugin. It’s something we might consider in the future, but really all your pages/ posts should be in wordpress and listed. Can you provide a scenario as to why you need this feature?

Viewing 1 replies (of 1 total)
  • The topic ‘How to add custom urls programmatically’ is closed to new replies.