Skip to content

Instantly share code, notes, and snippets.

@ManiruzzamanAkash
Created August 15, 2023 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ManiruzzamanAkash/3a9f162a278aa18e1a2fae53608bf1a3 to your computer and use it in GitHub Desktop.
Save ManiruzzamanAkash/3a9f162a278aa18e1a2fae53608bf1a3 to your computer and use it in GitHub Desktop.
WordPress sample test Sitemap generator example
<?php
wp_register_sitemap_provider( 'test', new TestSiteMap() );
/**
* XML sitemap provider.
*/
class TestSiteMap extends \WP_Sitemaps_Provider {
public function __construct() {
$this->name = 'tests';
}
public function get_url_list( $page_num, $object_subtype = '' ) {
$url_list[] = array(
'loc' => 'https://www.google.com',
);
return $url_list;
}
public function get_max_num_pages( $object_subtype = '' ) {
return 1; // change as your needs.
}
protected function get_max_urls() {
return 100; // change if wants to change from 100 to any other.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment