Remove specific URL from sitemap

#264207
Viewing 15 replies - 1 through 15 (of 15 total)
  • Prabhat
    Rank Math agency

    Hello,

    Thank you for contacting us.

    Could you please share some of the affected URLs so that we can check them on our end?

    Also, please follow the below steps and see if that removes those URLs from the sitemap:
    1. Flush the Sitemap cache by following this video screencast:
    https://i.rankmath.com/pipRDp

    2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
    https://rankmath.com/kb/exclude-sitemaps-from-caching/

    3. Clear your website and browser’s cache.

    With that being said, you can use this filter to filter the items before they’re added to the sitemap: https://rankmath.com/kb/filters-hooks-api-developer/#filter-sitemap-item

    Hope this helps.

    Thank you.

    IMK
    Rank Math free

    Thank you for your prompt response.

    I pass you the two screenshots:

    http://prntscr.com/1tcb3a2

    http://prntscr.com/1tcb7wp

    Prabhat
    Rank Math agency

    Hello,

    I tried to check your sitemaps but I was blocked by a forbidden error. Here’s a screenshot: https://i.rankmath.com/GXzGiB

    The same forbidden error is received when we try to access the affected URL: https://i.rankmath.com/zeQjXQ

    Please verify the situation and let us know so that we can investigate further.

    Looking forward to helping you.

    Thank you.

    IMK
    Rank Math free

    Thank you for the notice and sorry for the inconvenience.

    Apparently it was due to the cache plugin.

    Can you try logging in again.

    Thanks

    Ankit
    Rank Math business

    Hello,

    I checked the sitemap URL and i can the archive page is indeed showing.

    If page doesn’t have the Page ID, You can the remove the archive page with the help of filter, Use the below filter code :

    add_filter( 'rank_math/sitemap/post_type_archive_link', function ( $link ) {
    
            //Add a conditional statement like:
    
     	if ( strpos( $link, '%project%' ) !== false ) {
     		return false;
     	}
    
    	return $link;
    } );

    Make sure to modify it according to your needs.

    Hope this clarifies your doubts. Let us know if you need any further assistance.

    Hello,

    We just wanted to get in touch to see if this solution has helped you or not.

    In case it didn’t, please let us know and we’ll do our best to assist you.

    Thank you.

    IMK
    Rank Math free

    Thanks for your answer.

    Sorry para the snippet doesnt work.

    You can check that the first url with the slug /projects/ is still in the sitemap.

    https://www.parkingsymarquesinas.com/portfolio-sitemap1.xml

    Regards

    Hello,

    Could you please test the following code?

    
    add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ) {
        if( $post_type === 'project' ) {
            return false;
        }
        return $archive_url;
    }, 10, 2 );
    

    This should help remove the archive link from the project CPT sitemap.

    Don’t hesitate to get in touch if you have any other questions.

    IMK
    Rank Math free

    Sorry, I meant to write Miguel instead of Antonio.

    By the way, I forgot to comment that the snippet doesn’t work.

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    IMK
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    IMK
    Rank Math free

    Done

    Hello,

    We updated the snippet on your website with the appropriate CPT name and now the archive URL is no longer showing on that sitemap.

    Don’t hesitate to get in touch if you have any other questions.

    IMK
    Rank Math free

    Miguel,

    Bravo, it works

    Thank you very much for your willingness to help.

    You can be proud

    Thanks

    Hello,

    Glad that helped.

    Please feel free to reach out to us again in case you need any other assistance.

    We are here to help.

    Thank you.

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

The ticket ‘Remove specific URL from sitemap’ is closed to new replies.