if ( $redirect_url ) { $redirect['query'
] =
_remove_qs_args_if_not_in_url( $redirect['query'
],
array
( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type'
),
$redirect_url );
} } } elseif ( is_object( $wp_rewrite ) &&
$wp_rewrite->
using_permalinks() ) { // Rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101.
if ( is_attachment() && !
array_diff( array_keys( $wp->query_vars
), array
( 'attachment', 'attachment_id'
) ) && !
$redirect_url ) { if ( !
empty( $_GET['attachment_id'
] ) ) { $redirect_url =
get_attachment_link( get_query_var( 'attachment_id'
) );
$redirect_obj =
get_post( get_query_var( 'attachment_id'
) );
if ( $redirect_url ) { $redirect['query'
] =
remove_query_arg( 'attachment_id',
$redirect['query'
] );
} } else {