אם אתם משתמשים בתוסף Rank Math SEO כדי לשלוט על אילו סוגי תוכן ייכללו במפת האתר, ייתכן ונתקלתם בהגדרה "Include in Sitemap" תחת Rank Math SEO → Sitemap Settings → Post Types.
עם זאת, יש מקרים שבהם נרצה לעקוף את ההגדרה הזו בתוכנית, למשל כשאנחנו רוצים להוציא סוג תוכן מסוים באופן דינמי או לפי תנאים מסוימים. במקרים כאלה ניתן להשתמש בפילטר המופיע מטה.
פילטר זה מאפשר לעקוף את ההגדרה "Include in Sitemap" הנמצאת תחת Rank Math SEO → Sitemap Settings → Post Types.
/**
* 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 ){
return $exclude;
}, 10, 2 );