exclude & flush/refresh

#382988
  • Hello –

    I have tried to refresh my sitemap following your instructions (increase post numbers – save, go to permalinks – change nothing save). It never refreshes.

    I have also tried to exclude posts for our client area – they still show up in the sitemap and I don’t want them to. I have this in my “exclude posts” field:
    322,527,355,358,525,240609,240643,240664,240362,240353,240331,240303,223257

    You really should specify if we need spaces or not – since you didn’t I have no spaces.

    I have this in “exclude terms” (since yesterday) : 53,95
    but since I can’t flush / refresh the sitemap I don’t know if that worked.

    We use kinsta – they claim there is no caching on our staging area – and none of the problems are from their end. How to I refresh then? Also how to I properly exclude posts? (I don’t want any of the “categories” from our client area showing up in the sitemap.

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

    Hello,

    Thank you for contacting the support and we regret the inconvenience caused.

    I checked the sitemaps and was unable to find any categories in the sitemap. Regarding the posts, could you share some of the URLs that you’ve excluded but are still appearing in the sitemaps so that we can have a closer look?

    Looking forward to helping you.

    THank you.

    Hello,

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

    Thank you.

    Hello again,

    For some reason the English category /client-area/ (and everything that follows the slash) is showing up in my sitemap. I have supposedly put the post ID and the tag ID in the exclusions but they are still visible.

    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.

    Hello,

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

    Thank you.

    Hello again maybe the exclusions are working but we just can’t see because we can never refresh the sitemap. The same one has been there for 5 days – even though we have augmented the number of posts in the sitemap saved changes, gone to permalink settings, saved changes. The sitemap just never refreshes.

    We are using Kinsta and your plugin warned us that with a NGINX server we needed to add in some code and Kinsta added this in for us and it changed nothing.

    # START Nginx Rewrites for Rank Math Sitemaps
    rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
    # END Nginx Rewrites for Rank Math Sitemaps

    (We repeated your refresh process several times)

    Shouldn’t there just be an option to generate a fresh sitemap? A configuration to create a new sitemap based on a schedule?

    Nigel
    Rank Math business

    Hello,

    Please try excluding your sitemaps from caching using the following guide: https://rankmath.com/kb/exclude-sitemaps-from-caching/, then flush the sitemaps one more time If that does not work, the next step will be to check if there is a theme/plugin conflict. To do that, please follow the steps in this article: https://rankmath.com/kb/check-plugin-conflicts/. Please notify us once you find a conflict source so we can evaluate further.

    Hope that helps. Please let us know if you have questions.

    Hello,

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

    Thank you.

    Hello – Kinsta has assured us that there is zero caching on our staging area and they have inserted the proper code for Nginx servers you provided. (I have updated the sensitive data to show your their screenshot). They said this is not coming from their end, but from yours.

    Ok – we finally found a way to update our sitemaps. (Just open a post – don’t do anything and click update – way easier than your multi-step procedure that never worked for us.)

    We still have a problem with exclusions. We want to exclude every post that contains a certain category. For some reason it works in French on our site – but not in English. I even tried changing the name & slug of one of my categories (ID 95) to something else – and all of the posts of that category are still visible in our posts sitemap. How do we exclude them? (See my first screenshots in the sensitive data).

    We have tried adding a space after the commas (you don’t mention if you need one) – that changed nothing. We have tried adding in more category IDs that doesn’t work either. We need a solution to automatically exclude all posts in any given categories.

    Hello,

    Our plugin doesn’t support excluding the posts of a specific category from the sitemap. The Exclude Terms option only excludes the taxonomies from the sitemap. If you want to exclude the posts in a category from your sitemap then you can modify and use the following filter: https://rankmath.com/kb/filters-hooks-api-developer/#change-remove-post-url

    Here is how to add a filter to your site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope this helps. Let us know if you need any other assistance.

    We use the plugin “My custom functions” for adding in PHP – I tried both hook 5 and 8 with 2 category IDs and neither work. (I went in after my changes I updated a post and that gave us a refreshed sitemap – but all of the posts of those categories are still in the sitemap.)

    Hello,

    Please remove the filter provided before and try applying the following filter to exclude all posts within a given category from your sitemap:

    
    add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ){
    
        $post_id = $object->ID;
    
        if( has_term( 111, 'category', $post_id ) ) { // Change 111 to the ID of the category
            $url = false;
        }
    
        return $url;
    }, 10, 3 );
    

    Hope this helps solve your issues.

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

    We will need at least 2 categories excluded. I tried this by putting a space then new ID then comma after where you have the 111 and that did not work. (When I didn’t put the final comma, it gave me a fatal error and I had to convert to a backup of the site.

    With only one ID where you have your 111 – it seems to work for us. What I ended up doing was putting this hook in two times – but is there a more succinct way of doing this so we don’t end up with 5 – 10 of this exact hook to accommodate our different categories?

    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 15 replies - 1 through 15 (of 16 total)

The ticket ‘exclude & flush/refresh’ is closed to new replies.