Canonical: after [34272], don't redirect rewrite endpoints on attachment URLs when pretty permalinks are enabled.
Fixes #19918. git-svn-id: https://develop.svn.wordpress.org/trunk@34643 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b9944f6331
commit
813bff7bdb
@ -39,7 +39,7 @@
|
||||
* @return string|void The string of the URL, if redirect needed.
|
||||
*/
|
||||
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||
global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
|
||||
global $wp_rewrite, $is_IIS, $wp_query, $wpdb, $wp;
|
||||
|
||||
if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ) ) ) {
|
||||
return;
|
||||
@ -157,7 +157,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||
|
||||
} elseif ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) {
|
||||
// rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101
|
||||
if ( is_attachment() && ! $redirect_url ) {
|
||||
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' ) );
|
||||
if ( $redirect_url ) {
|
||||
|
Loading…
Reference in New Issue
Block a user