No Index WC Vendors

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

    Thank you for contacting Rank Math today.

    You can make use of the following code to change the robots meta for the vendor pages.
    This code should be added to your theme’s functions.php file.

    /**
     * Filter Rank Math robots meta data.
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
            if(WCV_Vendors::is_vendor_page()){
            $robots['index'] = "noindex";
    	return $robots;
            }
            return $robots;
    });

    I hope this info helps. Thank you.

    ​​​​​​

    Thank you. Can you please give me the similar code for noindexing pagination?

    Hi there,

    Thanks for the follow up.

    You can modify the above code to the following:

    /**
     * Filter Rank Math robots meta data.
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
            if(WCV_Vendors::is_vendor_page() || is_paged()){
            $robots['index'] = "noindex";
    	return $robots;
            }
            return $robots;
    });

    I hope this info helps. Thank 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 ‘No Index WC Vendors’ is closed to new replies.