Support » How-To and Troubleshooting » How to redirect image attachment urls to parent post?
2 years, 6 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…