Removing MailPoet Pages from WordPress XML Sitemaps

WordPress 5.5 introduced XML Sitemaps. If you wish to prevent internal MailPoet pages from being added to the wp-sitemap.xml file, you can use the code snippet below:

add_filter( 'wp_sitemaps_post_types', 'remove_post_type_from_wp_sitemap' );
function remove_post_type_from_wp_sitemap( $post_types ) {
     unset( $post_types['mailpoet_page'] ); 
     return $post_types;
} 

We always recommend you add these code snippets to your website using the plugin: Code Snippets.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.