• Activity Feed
  • Groups
  • Forums
  • Service
  • en_USEnglish
    • arArabic
    • zh_TWChinese
    • fr_FRFrench
    • de_DEGerman
    • jaJapanese
    • es_ESSpanish
    • pt_PTPortuguese
  • classify
    • Plugins & Themes
      • Gutenberg Block Developer
      • Plugin Development
      • Plugin Usage and Recommendation
      • Theme Development & Customization
    • Speed & Optimization
      • Database Optimization
      • Page Load optimization
      • Server Level Optimization
    • Security & Backup
      • Data Backup & Recovery
      • Site Security Measures
      • SSL Certificates
    • Server Ops & Admin
      • Automatic Management
      • Performance Monitoring & Tuning
      • Server Selection & Configuration
      • System Security Update
    • Dev Tools & Workflow
      • Continuous Integration/Continuous Deployment (CI/CD)
      • Development Environment Configurations
      • Version Control
    • REST API & Integrations
      • Integration with Third-Party Services
      • REST API Use
    • FAQs & Solutions
      • Debugging Tips
      • Error Detection
    • Code Snippets & Dev Tips
      • Code Snippets Library
      • Developer Tips
    • Advanced Extensions
      • Customized Content Type (CPT)
      • Multisite Management
    • SEO Tips
      • Content Optimization Tips
      • Sitemap and Robots.txt
      • SEO Optimization Techniques

    Shopping Cart

    No products in the cart.
    Sign in Sign up

    Shopping Cart

    No products in the cart.
    • Activity Feed
    • Groups
    • Forums
    • Service
    • en_USEnglish
      • arArabic
      • zh_TWChinese
      • fr_FRFrench
      • de_DEGerman
      • jaJapanese
      • es_ESSpanish
      • pt_PTPortuguese
    • classify
      • Plugins & Themes
        • Gutenberg Block Developer
        • Plugin Development
        • Plugin Usage and Recommendation
        • Theme Development & Customization
      • Speed & Optimization
        • Database Optimization
        • Page Load optimization
        • Server Level Optimization
      • Security & Backup
        • Data Backup & Recovery
        • Site Security Measures
        • SSL Certificates
      • Server Ops & Admin
        • Automatic Management
        • Performance Monitoring & Tuning
        • Server Selection & Configuration
        • System Security Update
      • Dev Tools & Workflow
        • Continuous Integration/Continuous Deployment (CI/CD)
        • Development Environment Configurations
        • Version Control
      • REST API & Integrations
        • Integration with Third-Party Services
        • REST API Use
      • FAQs & Solutions
        • Debugging Tips
        • Error Detection
      • Code Snippets & Dev Tips
        • Code Snippets Library
        • Developer Tips
      • Advanced Extensions
        • Customized Content Type (CPT)
        • Multisite Management
      • SEO Tips
        • Content Optimization Tips
        • Sitemap and Robots.txt
        • SEO Optimization Techniques
      • Profile photo of Harris

        Harris posted an update

        8 months ago

        Level 2

        How to remove specific post type indexes from Yoast sitemap_index.xml


        I used Yoast’s API to create a custom XML sitemap that combines all of my website pages and a few other post types into one. I do the same thing for translated pages so that they are in their own sitemap.

        I want to remove the Yoast-created XML sitemaps from the sitemap_index.xml so only my custom sitemap is there. I cannot find any references to how to accomplish this. I tried using the wpseo_sitemap_exclude_post_type filter to remove the post types for the other sitemaps, but doing so removed my custom sitemap from the sitemap index as well (since it is comprised of the same post types that I excluded).

        Is there any way to do this?

        stackoverflow.com

        Page not found

        Stack Overflow | The World’s Largest Online Community for Developers

        Move Photo to...

        No albums found. Please create and select album.

        Albums
        Cancel Create
        Create new album Cancel Move
        B8XqrAzu
        Martin
        2 Comments
        • Profile photo of Martin
          Martin
          Level 2

          You can use the below code on the functions.php file:

          function yoast_sitemap_exclude_post_type_sp( $value, $post_type ) {

          // remove post_type : product, post, page

          if ( $post_type == ‘product’ || $post_type == ‘post’ || $post_type == ‘page’) {

          return true;

          }

          }

          add_filter( ‘wpseo_sitemap_exclude_post_type’, ‘yoast_sitemap_exclude_post_type_sp’, 10, 2 );

          [enter image description here][1]

          [1]: https://i.sstatic.net/0k4bAmIC.png

          8 months ago
          • Profile photo of Harris
            Harris
            Level 2

            @ava-martin How does this solve the issue? Please explain what you’ve you changed to address the issue.

            Also, I mentioned in my description that I already tried using the wpseo_sitemap_exclude_post_type filter to exclude the “page” and “people” post types, but doing so caused my custom sitemaps to disappear from the index as well. 😅

            8 months ago
      • Public
      • All Members
      • My Connections
      • Only Me
      • Public
      • All Members
      • My Connections
      • Only Me
      • Public
      • All Members
      • My Connections
      • Only Me
      © 2025 - OpenByt - The ultimate source for free WordPress knowledge
      • Home
      • Community
      • About Us
      • Contact Us
      • Join Us
      • Notice
      • Team
      • Privacy Policy
      Loading...
      en_US English
      en_US English
      fr_FR French
      de_DE German
      ja Japanese
      es_ES Spanish
      pt_PT Portuguese
      zh_TW Chinese
      ar Arabic

      Report

      There was a problem reporting this post.

      Harassment or bullying behavior
      Contains mature or sensitive content
      Contains misleading or false information
      Contains abusive or derogatory content
      Contains spam, fake content or potential malware

      Block Member?

      Please confirm you want to block this member.

      You will no longer be able to:

      • See blocked member's posts
      • Mention this member in posts
      • Invite this member to groups
      • Message this member
      • Add this member as a connection

      Please note: This action will also remove this member from your connections and send a report to the site admin. Please allow a few minutes for this process to complete.

      Report

      You have already reported this .
      Go to mobile version

      Insert/edit link

      Enter the destination URL

      Or link to existing content

        No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.