Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once 'custom-sitemap.php';
- add_filter('rank_math/sitemap/providers', function( $external_providers ) {
- $external_providers['custom'] = new \RankMath\Sitemap\Providers\Custom();
- return $external_providers;
- });
- add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ) {
- if ( 'post' == $type ) {
- if ( $object->ID == 457 ) {
- return false; // Remove this entry from the sitemap
- }
- if ( $object->post_parent == 457 ) {
- return false; // Remove this entry from the sitemap
- }
- }
- return $url; // Return the URL if it doesn't match the exclusion criteria
- }, 10, 3 );
- add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement