-
Hi!
I’ve setup sitemap to exclude certain categories, but they are still in the list.
I’ve added 3 categories to be excluded (5,477,478), it’s news and test posts, even pages that’s been marked no index are on the list..
This is the current list, and only one of them should be on the list (see screenshot)
-
Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated 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.
Login url added..
Hello,
Thank you for the follow up.
I have checked your site. No posts are set to noindex. On your page you have published 30 pages, only 21 are showing up on sitemap, 9 of them are set to noindex. I have attached a screencast of this in the sensitive section so yu can confirm.
Please note that excluding terms from sitemap only excludes the individual terms not the posts or pages included. To exclude individual posts you’d have to add the post ids for exclusion or set the individual posts to noindex in advanced meta box.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Oh,I c, I thought that by adding a category to be noindex then all posts that have that category will be excluded from the sitemap.
That’s actually the thing I’m after, there is no code or anything I can add to make it happened?
I’ve been using Yoast, and they have that function.
The issue is that my posts will be created by visitors on the front end, and if they choose a category called dontallow (something like that) their post should not be found by searching my site (fixed) and of course not indexed by robots, so I want them excluded from the sitelist.I just changed from Yoast to RankMath because they said it was better..
So can RankMath solve this issue?
Hello,
I have done a little code for you that you can add at the end of your functions.php file in your current theme:
/** * Allows filtering of the robots meta data. * * @param array $robots The meta robots directives. */ add_filter( 'rank_math/frontend/robots', function( $robots ) { global $post; $category_detail=get_the_category('4');//$post->ID foreach($category_detail as $cd){ if($cd->term_id=='5'||$cd->term_id=='477'||$cd->term_id=='478'){ $robots['index'] = 'noindex'; $robots['follow'] = 'follow'; break; } } return $robots; });
Looking forward to help you.
Thank you so much, I do however have one question.
This code only instructs the robots to not index the posts?, but they are still listed in the sitemap?I’ve made a big fuss about that these posts isn’t going to be listed anywhere, there are no links pointing to these posts, so if you don’t know the correct address, you won’t find them, so that’s why it’s so important to NOT have them added to the sitemap..
So, again, will this code keep them from the list or just instruct the robots to ignore them..
Hello,
The posts set as no-index shouldn’t appear in the sitemaps (if they do now, you can save the permalinks so the sitemap regenerates and then they shouldn’t be there anymore).
Looking forward to help you.
Now I think we’re misunderstanding each other…
The script, to my functions.php
What does it do?It don’t set the posts with the corresponding categories as noindex.
I just tried to create a post with category 478 and it still ended up on the sitelist..Hello,
Thank you for contacting Rank Math today.
The access URL seems to have expire. Please update so we can look into this further.
Looking forward to helping you. Thank you.
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
Unfortunately with the access you provided I cannot get to the functions.php. I have tweaked the code provided y my colleague. Could you please try it and let us know. Please make sure to check the test post source to see if a noindex has been added.
/** * Allows filtering of the robots meta data. * * @param array $robots The meta robots directives. */ add_filter( 'rank_math/frontend/robots', function( $robots ) { global $post; $category_detail=get_the_category($post->ID ); foreach($category_detail as $cd){ if($cd->term_id=='5'||$cd->term_id=='477'||$cd->term_id=='478'){ $robots['index'] = 'noindex'; $robots['follow'] = 'follow'; break; } } return $robots; });
Looking forward to helping you. Thank you.
.. Sorry.. nothing..
I don’t know how I can give you access to functions.php…I’ve installed a file manager, so you can access the functions.php, it’s in the hello-child theme..
The ticket ‘Excluded categories still in sitemap’ is closed to new replies.