PHP Fatal Error When Adding Pages To Sitemap
-
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 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘PHP Fatal Error When Adding Pages To Sitemap’ is closed to new replies.