228 | | if ( is_singular() && ! is_front_page() && get_query_var('page') ) { |
229 | | if ( !$redirect_url ) |
230 | | $redirect_url = get_permalink( get_queried_object_id() ); |
231 | | $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' ); |
232 | | $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); |
| 228 | if ( is_singular() && ! is_front_page() ) { |
| 229 | if ( get_query_var('page') ) { |
| 230 | if ( ! $redirect_url ) |
| 231 | $redirect_url = set_url_scheme( get_permalink( get_queried_object_id() ) ); |
| 232 | $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' ); |
| 233 | $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); |
| 234 | } else { |
| 235 | $post_url = set_url_scheme( get_permalink( get_queried_object_id() ) ); |
| 236 | // If the full post's URL is not within the requested url, lets redirect there. |
| 237 | if ( strpos( $requested_url, $post_url ) === false ) |
| 238 | $redirect_url = $post_url; |
| 239 | } |