Hello,
We apologize for the issue you are facing with the indexing of pages ending with "?currency=USD." To prevent search engines from indexing these pages, you can add a noindex meta tag to those specific URLs. This will inform search engines not to index them while still allowing users to access the content.
Here’s how you can add a noindex meta tag using Rank Math:
- Go to your WordPress dashboard.
- Navigate to the page or post you want to edit.
- Scroll down to the Rank Math SEO settings.
- In the Advanced tab, find the Robots Meta settings.
- Set the Noindex option to Yes.
- Save your changes.
Alternatively, if you want to use the robots.txt file, adding Disallow: /*?currency=USD
will prevent search engines from crawling those pages. However, keep in mind that using robots.txt only prevents crawling and does not guarantee that the pages will be removed from the index if they are already indexed. It’s generally better to use the noindex meta tag for this purpose.
If you need further assistance or have more questions, please feel free to reply to this ticket, and a human agent from our support team will assist you further.
Thank you for raising this concern!
Sources:
How to Fix "Crawled – Currently Not Indexed" Error in Google Search Console » Rank Math
Hello,
Thank you for contacting us. We apologize for any inconvenience this issue may have caused.
Yes, adding that disallow rule should prevent Googlebot from crawling such URLs going forward.
You can however still set them to noindex
using the following snippet:
add_filter('rank_math/frontend/robots', function ($robots) {
$url = home_url($_SERVER['REQUEST_URI']);
if (strpos($url, '?currency=USD'))
{
$robots["index"] = 'noindex';
$robots["follow"] = 'nofollow';
}
return $robots;
});
Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
We hope this helps. Please let us know if you have further questions or concerns.
Thank you.
Hello,
Thank you! What about /feed/ pages? I’ve already added a Disallow rule in my robots.txt, but I still see many /feed/ pages indexed in Google Search Console.
Can I use a similar code snippet to set them to noindex as well?
Hello,
Yes, you can replace the filter with this one so the URLs with /feed/ will be also set to noindex:
add_filter('rank_math/frontend/robots', function ($robots) {
$url = home_url($_SERVER['REQUEST_URI']);
if (strpos($url, '?currency=USD') !== false || strpos($url,'/feed/'))
{
$robots["index"] = 'noindex';
$robots["follow"] = 'nofollow';
}
return $robots;
});
Looking forward to helping you.
Just did it! Thank you for your time!
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.