Ready to get started?Download WordPress


How to redirect image attachment urls to parent post? (2 posts)

  1. Gemini23
    Posted 3 months ago #

    I have seen this question asked before but cannot see an answer that works...

    I would like my image attachment urls to redirect to their parent posts…

    I have tried:

    1) adding this to the first line of image.php but it doesn’t work at all

    <?php wp_redirect(get_permalink($post->post_parent)); ?>

    2) I have added attachment redirect plugin but that just redirects everything to the homepage.

    So... Please can someone advise how I can get image attachments to redirect to their parent posts…

  2. Halespade
    Posted 3 months ago #

    You can use wordpress SEo for the same. It comes inbuilt with this functionality. Attachment page can cause duplicate and lean content issues with your website. In April 2012, we faced same problem at servicerepairmanuals.net and after rectifying mistake our website have recovered lot from panda.


You must log in to post.

About this Topic