How do I prevent product custom fields from being indexed?

#765510
  • Resolved Alireza
    Rank Math free

    I have custom taxonomy for my products such as size, weight, etc and I don’t want their urls (like weight/18-kg/) to be indexed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    To prevent product custom fields like size, weight, etc., from being indexed, you can follow these steps:

    1. Add Custom Fields to Rank Math: If your products use custom fields to display data on the frontend, you can add these field names in Rank Math. This will help Rank Math include data from these fields during on-page analysis. Here is an example of how to add custom fields in Rank Math:
    size
    weight
    1. Exclude Custom Fields from Indexing: To prevent these custom fields’ URLs from being indexed, you can configure Rank Math to exclude them. Unfortunately, Rank Math does not have a specific setting to exclude custom fields from indexing. However, you can use meta robots tags or robots.txt to prevent search engines from indexing these URLs.

    If you need further assistance with excluding custom fields from indexing, please reply to this ticket, and a human agent from the Rank Math Support team will assist you promptly.

    Thank you for reaching out with your concern.

    Sources:
    Rank Math ‘Titles and Meta’ Options and Settings
    General Tab in Meta Box of Rank Math SEO Plugin
    Rank Math General Settings
    Why Google Hasn’t Indexed Your Post, Page, and/or Website? » Rank Math
    Google Search Console Missing Field Warning » Rank Math

    Alireza
    Rank Math free

    Please tell me how to use meta robots tags or robots.txt to prevent search engines from indexing the custom fields.

    Hello,

    Thank you for your patience.

    Could you please share the URLs with size and other taxonomy so we can suggest the complete filter to noindex them?

    Meanwhile, here’s the filter you can use and customize to noindex the URL with /weight/:

    add_filter('rank_math/frontend/robots', function ($robots) {
    $url = home_url($_SERVER['REQUEST_URI']);
    if (strpos($url, 'weight') !== false)) {
    $robots["index"] = 'noindex';
    $robots["follow"] = 'nofollow';
    };
    return $robots;
    });

    Here’s a link to how to apply this to your site:
    https://rankmath.com/kb/filters-hooks-api-developer/

    Looking forward to helping 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 3 replies - 1 through 3 (of 3 total)

The ticket ‘How do I prevent product custom fields from being indexed?’ is closed to new replies.