ControlledChaos of Controlled Chaos Design
8/9/2016 - 6:39 PM

Redirect WP image attachment page to parent.

Redirect WP image attachment page to parent.

<?php

wp_redirect( get_permalink( $post->post_parent ) );

?>

Redirect WP image attachment page to parent

WordPress Snippet

Create or edit image.php in the theme root folder. Add the following line of code.