Custom Post-Type exclusion

#624181
  • Resolved Anonymous
    Rank Math free

    In my sitemap, I have some Custom Post-Types (they aren’t pages) that I can’t exclude. For example: in the I need to exclude the first URL which is not a proper page, but it doesn’t have any post/page ID to put at the Exclusion field in General options (as I made with other pages).

    The website is still in development.

    [links moved to sensitive data section]

Viewing 1 replies (of 1 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.

    Upon checking your sitemap, it seems that it is the archive page of that post type.

    In this case, you can use this filter to remove the /cultura/ URL from the sitemap:

    add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ){
    if ($post_type == 'cultura'){ // match to the actual post type name
    	$archive_url = false;
    }
    	return $archive_url;
    }, 10, 2 );

    And here’s how you can add a filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how this goes.

    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Custom Post-Type exclusion’ is closed to new replies.