214 | | if ( is_singular() && ! is_front_page() && get_query_var('page') ) { |
215 | | if ( !$redirect_url ) |
216 | | $redirect_url = get_permalink( get_queried_object_id() ); |
217 | | $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' ); |
218 | | $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); |
| 214 | if ( is_singular() && ! is_front_page() ) { |
| 215 | if ( get_query_var('page') ) { |
| 216 | if ( ! $redirect_url ) |
| 217 | $redirect_url = get_permalink( get_queried_object_id() ); |
| 218 | $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' ); |
| 219 | $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); |
| 220 | } else { |
| 221 | $post_url = get_permalink( get_queried_object_id() ); |
| 222 | // If the full post's URL is not within the requested url, lets redirect there. |
| 223 | if ( strpos( $requested_url, $post_url ) === false ) |
| 224 | $redirect_url = $post_url; |
| 225 | } |