0

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?

2
  • 1
    If you mean that you've edited the image markup into the category description at wp-admin/edit-tags.php?taxonomy=category then can't you get a long way towards solving this by simply not wrapping those images in anchor tags?
    – s_ha_dum
    Commented Oct 26, 2013 at 18:33
  • 1
    If the guess of @s_ha_dum is wrong, can you explain what exactly you mean with "I got images in my category descriptions"? (and post relevant code if exists)
    – gmazzap
    Commented Oct 26, 2013 at 23:15

1 Answer 1

0

The best way for this is either use:

Attachment Pages Redirect plugin or use Wordpress Seo.

You can use Attachment pages redirect to redirect the attachment pages to post page or home page. And also you can use WordPress SEO to redirect to homepage.

Hope this worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.