Disabling Mapped Pages from the Sitemap (Yoast and RankMath)
WP Landing Kit provides the ability to exclude the mapped pages from the sitemap generated by Yoast or RankMath using custom filters. Below are the steps for disabling mapped pages from appearing in the sitemap.
1. Disable Mapped Pages from Yoast Sitemap
To exclude the mapped pages from the Yoast sitemap, you can use the wplk_skip_yoast_sitemap_item_mapping filter.
2. Disable Mapped Pages from RankMath Sitemap
To exclude a mapped page from the RankMath sitemap, you can use the wplk_skip_rankmath_sitemap_item_mapping filter.
Steps:
To add the filter to your current website, follow the steps below:
Access Theme Editor:
- Navigate to Dashboard > Appearance > Theme File Editor.
- Select your active theme or child theme.
Edit
functions.php:- In the Theme Files section, open the
functions.phpfile.
- In the Theme Files section, open the
Add the Filter:
- Add the following code at the end of the
functions.phpfile:
phpadd_filter('wplk_skip_yoast_sitemap_item_mapping', '__return_true'); // For Yoast add_filter('wplk_skip_rankmath_sitemap_item_mapping', '__return_true'); // For RankMath- Add the following code at the end of the
Save Changes:
- Click Update File to save.
