if ( $post_id ) { $redirect_url =
get_permalink( $post_id );
$redirect_obj =
get_post( $post_id );
$redirect['path'
] =
rtrim( $redirect['path'
],
(int) get_query_var( 'page'
) . '/'
);
$redirect['query'
] =
remove_query_arg( 'page',
$redirect['query'
] );
} } if ( !
$redirect_url ) { $redirect_url =
redirect_guess_404_permalink();
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() ) {