Hello,
Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.
Yes, you can exclude the post type from your sitemap on your WordPress dashboard > Rank Math > Sitemap Settings > Find the post type on the left tab, then disable this option

If somehow it’s still not getting removed from your sitemap index, then flush the Sitemap cache by following this video screencast:
https://i.rankmath.com/xXXhDt
Hope that helps.
Thank you.
		
	 
	
	
	
	
 
			
				
	
	
		
		Thanks for the reply.
I know how to do those things. I guess the best way to address the problem is to say that there is not an option for the page type “Ontrapages” so I can’t say don’t include, because the option doesn’t exist.
Let me know if you have any questions.
		
	 
	
	
	
	
 
			
				
	
	
		
		Hello,
It seems that we do not have a UI option for that particular plugin’s CPT sitemap.
In this case, you can try adding this filter to your site:
/**
 * Filter decision if post type is excluded from the XML sitemap.
 *
 * @param bool   $exclude Default false.
 * @param string $type    Post type name.
 */
add_filter( 'rank_math/sitemap/exclude_post_type', function( $exclude, $type ){
      $type = "ontrapage";
	return $type;
}, 10, 2 );
Please add this code to the last line of your theme’s functions.php file. 
You may also refer to this article to further guide you in implementing the code: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let us know how this goes.
Thank you.
		
	 
	
	
	
	
 
			
				
	
	
		
		Thanks for the reply.
Added to functions and it removes all sitemaps except the videos one.
Tried code snippet to see if that would work and same issue.
Could you please recheck the code and confirm it is correct?
Sitemaps to exclude are named as below if that is required info
/ontrapage-sitemap1.xml
/ontrapage-sitemap2.xml
		
	 
	
	
	
	
 
			
				
	
	
		
		Hello,
Can you please try this filter code instead?
add_filter( 'rank_math/sitemap/exclude_post_type', function( $value, $type ){
    if ( 'ontrapage' === $type ) {
        return true;
    }
    return $value;
}, 11, 2 );
After adding the filter code, please flush the sitemap cache once more.
Hope that helps solve your issue.
Don’t hesitate to get in touch if you require any further assistance.
		
	 
	
	
	
	
 
			
				
	
	
		
		Amazing. This has worked!
Thank you for your help 🙂
		
	 
	
	
	
	
 
			
				
	
	
		
		Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.