Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
I have just tested this issue on my end using the same plugin but the gallery is correctly set to “noindex” when this option is enabled on the Rank Math Titles & Meta settings as you can see below:
Please investigate whether you have another plugin that is modifying the robots meta on your site by performing the tests outlined on the following page: https://rankmath.com/kb/check-plugin-conflicts/
Let me know how this goes. Thank you.
​​​​​​​
Hi Michael,
I did some additional testing.
In fact the settings work for new galleries: when I create a new one, it’s set to noindex. Existing galleries, however, remain index. How can I bulk set all of them to noindex?
Hi Denis,
Thanks for getting back to us.
I am afraid that we do not have a bulk edit option but you can add some PHP code to your theme to modify the index meta for the gallery post type like so:
/**
* Allows filtering of the robots meta data.
*
* @param array $robots The meta robots directives.
*/
add_filter( 'rank_math/frontend/robots', function( $robots ) {
$url = $_SERVER["REQUEST_URI"];
$isItGalleryPage = strpos($url, 'rl_gallery');
if ($isItGalleryPage!==false){
$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.