Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anonymous/e4f48a41192b4d64fdf3 to your computer and use it in GitHub Desktop.
Save anonymous/e4f48a41192b4d64fdf3 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Oct 1, 2014.
    9 changes: 9 additions & 0 deletions WordPress disable the attachment page by redirecting
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    if ( $post->post_parent )
    {
    wp_redirect( get_permalink( $post->post_parent ), 301 );
    }
    else
    {
    wp_redirect( site_url(), 301 ) );
    }
    die();