Allow only Googlebot on Robots Meta Tag

#274502
  • Resolved Mr Bibim
    Rank Math free

    Hello,

    I try to find a way to customize the Robots Meta Tag but I cant do it with Rankmath.

    I try to index Googlebot only, and noindex other bot (Bingbot, etc).

    Cant do that with Rankmath. I belive Yoast have option to custom Meta Tag Manually

    Please help

    Thanks

Viewing 1 replies (of 1 total)
  • Tammy
    Rank Math business

    Hello,

    Thank you for contacting Rank Math today, and we apologize for any inconvenience this may have caused.

    You should be able to untick anything you don’t want to be displayed and remove Advanced Robots Meta from Rank Math > Titles & Meta > Advanced Robots Meta.

    However, the follow and index will still be displayed because Rank Math generates them by default.

    Use the following code at the bottom of your theme’s functions.php to delete it:

    /**
     * Rank Math: filter the robots meta data.
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    	unset( $robots['index'] );
    	unset( $robots['follow'] );
    	return $robots;
    });

    You can see the code here:
    https://rankmath.com/kb/filters-hooks-api-developer/#change-robots-meta

    I hope this information is helpful, and please do not hesitate to contact us if you require any additional support.

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

The ticket ‘Allow only Googlebot on Robots Meta Tag’ is closed to new replies.