Question

I'd like to prevent google from indexing my attachment/image pages. So for the images I placed in my posts that's no problem - I just redirect the attachment page to the post parent by creating a new file "image.php" with this code <?php wp_redirect(get_permalink($post->post_parent)); ?>

The problem is though that I got images in my category descriptions, which don't even have a post parent, so the redirect doesn't work.

Is there a way that I can redirect the attachment page to the category page that has the picture in its description? Or maybe a way I can put all my attachmentpages on noindex?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top