1. Go to this page and download the library: Download bonnier/wp-bonnier-sitemap library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bonnier / wp-bonnier-sitemap example snippets
add_filter('sitemap_allowed_post_types', function(array $postTypes) {
// Don't handle sitemaps for the page post type.
return array_filter($postTypes, function(string $postType) {
return $postType !== 'page';
});
}, 10);
add_filter('post_tag_minimum_count', function (int $count) {
// For SEO purposes, our sitemap cannot have less than 10 posts for tag pages.
return 10;
}, 10);
add_filter('user_minimum_count', function (int $count) {
// For SEO purposes, our sitemap cannot have less than 10 posts for user pages.
return 10;
}, 10);