Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save reficedev/c5d0451124c74f0afc67c127ccaa582f to your computer and use it in GitHub Desktop.
Save reficedev/c5d0451124c74f0afc67c127ccaa582f to your computer and use it in GitHub Desktop.
<?php
// à mettre dans /wp-content/themes/mon_theme-child/image.php
global $post;
if ( $post && $post->post_parent ) {
wp_redirect( get_permalink( $post->post_parent ), 301 );
exit;
} else {
wp_redirect( home_url( '/' ), 301 );
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment