Support » Plugin: XML Sitemaps » PHP Fatal Error When Adding Pages To Sitemap

  • worthyofblame

    (@worthyofblame)


    Hi,

    I used to be able to add custom pages to the sitemap using the following function:

    function add_pages_to_sitemap() {
    	$generatorObject = &GoogleSitemapGenerator::GetInstance();
        if($generatorObject!=null) {
        $generatorObject->AddUrl("https://www.example.com/url-1/",mktime(0, 0, 0, 1, 17, 2019),"monthly",0.4);
        $generatorObject->AddUrl("https://www.example.com/url-1/",mktime(0, 0, 0, 1, 17, 2019),"monthly",0.4);
        }
    }
    add_action("sm_buildmap", "add_pages_to_sitemap");

    But now I get the following error:

    PHP Fatal error: Uncaught Error: Call to undefined method GoogleSitemapGenerator::GetInstance()

    Could you please assist in fixing this issue? I can no longer find documentation on how to add pages to the sitemap via PHP (these pages lie outside the WordPress installation).

    Thank you for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter worthyofblame

    (@worthyofblame)

    Note I have tested various versions of the plugins and have found:
    4.1.5 is not working
    4.1.4 is not working
    4.1.3 is not working
    4.1.2 is not working
    4.1.1 is working
    4.1.0 is working

    “Not working” = same error as above.

    “Working” = no error.

    Thread Starter worthyofblame

    (@worthyofblame)

    Hi,

    Any response from the plugin authors?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.