WordPress.org

Make WordPress Core

Ticket #11023: 11023.diff

File 11023.diff, 762 bytes (added by oso96_2000, 6 years ago)
  • src/wp-includes/canonical.php

    diff --git src/wp-includes/canonical.php src/wp-includes/canonical.php
    index 5aefe2b..558779b 100644
    function redirect_canonical( $requested_url = null, $do_redirect = true ) { 
    123123
    124124        } elseif ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) {
    125125                // rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101
    126                 if ( is_attachment() && !empty($_GET['attachment_id']) && ! $redirect_url ) {
     126                if ( is_attachment() && ! $redirect_url ) {
    127127                        if ( $redirect_url = get_attachment_link(get_query_var('attachment_id')) )
    128128                                $redirect['query'] = remove_query_arg('attachment_id', $redirect['query']);
    129129                } elseif ( is_single() && !empty($_GET['p']) && ! $redirect_url ) {