Exclude From Sitemap: All Pages From Page Builder Plugin

#562407
  • Resolved Anonymous
    Rank Math free

    Hi Team,

    I have Ontrapages as a plugin that essentially allows WordPress to incorporate pages built in Ontraport.

    The site map builder in Rankmath includes these pages by pointing to their own sitemap ‘/ontrapage-sitemap.xml’ (which don’t exist, i.e. they are 404s in the sitemap). Almost all of these pages are no index and I don’t actually want to include them in a site map.

    Is there a way to tell Rankmath to ignore any post types from this plugin?

    Couldn’t find the answer anywhere online.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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

    Include

    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.

    Anonymous
    Rank Math free

    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.

    Anonymous
    Rank Math free

    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.

    Anonymous
    Rank Math free

    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.

Viewing 7 replies - 1 through 7 (of 7 total)

The ticket ‘Exclude From Sitemap: All Pages From Page Builder Plugin’ is closed to new replies.