• Hi everyone,

    I installed version 3.1.2 of Google XML Sitemaps today and everything worked fine. Using the suggestions in the developer documentation, I developed my own short plugin to add an additional set of urls to the sitemap. I’m using the following code as suggested in the documentation:

    function your_pages() {
    	$generatorObject = &GoogleSitemapGenerator::GetInstance(); //Please note the "&" sign!
    	if($generatorObject!=null) $generatorObject->AddUrl("http://www.myurl.com/additionalpages",time(),"daily",0.5);
      }
    
      add_action("sm_buildmap","your_pages");

    When I rebuild the sitemap, everything from the blog appears in the sitemap as normal, but the additional pages do not appear. I’ve done some playing around to verify that my plugin is active.

    The AddUrl method successfully processes the new urls right up to the point of writing them in the file. I’ve echoed $s to the screen following this line of code in AddElement method

    $s = $page->Render();

    and verified that $s has the appropriate values for each of the urls I’m entering through my own plugin. The problem seems to be that the file handles are lost at some point.

    $this->_fileHandle is true for the blog posts, but false for the new urls from my plugin. Any ideas why this might happen? I’m stumped.

  • The topic ‘[Plugin: Google XML Sitemaps] Trouble adding adnl urls through another plugin’ is closed to new replies.