WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/wp-includes/canonical.php

    r14954 r15463  
    157157            $obj = $wp_query->get_queried_object();
    158158
    159             if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) ) && !is_wp_error($tax_url) ) {
    160 
     159            if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) )
     160                    && !is_wp_error($tax_url) && $redirect['query'] ) {
    161161                if ( is_category() ) {
    162162                    $redirect['query'] = remove_query_arg( array( 'category_name', 'category', 'cat'), $redirect['query']);
     
    344344    if ( !$redirect_url || $redirect_url == $requested_url )
    345345        return false;
     346       
     347    // Hex encoded octets are case-insensitive.
     348    if ( false !== strpos($requested_url, '%') ) {
     349        if ( !function_exists('lowercase_octets') ) {
     350            function lowercase_octets($matches) {
     351                return strtolower( $matches[0] );
     352            }
     353        }
     354        $requested_url = preg_replace_callback('|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url);
     355    }
    346356
    347357    // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE
Note: See TracChangeset for help on using the changeset viewer.