WordPress.org

Make WordPress Core

Changeset 12202


Ignore:
Timestamp:
11/17/09 21:01:03 (4 years ago)
Author:
ryan
Message:

Fix undefined index notice in canonical. Props dd32. fixes #11057

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/canonical.php

    r12040 r12202  
    126126            if ( $redirect_url = get_year_link(get_query_var('year')) ) 
    127127                $redirect['query'] = remove_query_arg('year', $redirect['query']); 
    128         } elseif ( is_category() && preg_match( '|^[0-9]+$|', $_GET['cat'] ) ) { 
     128        } elseif ( is_category() && !empty($_GET['cat']) && preg_match( '|^[0-9]+$|', $_GET['cat'] ) ) { 
    129129            if ( $redirect_url = get_category_link(get_query_var('cat')) ) 
    130130                $redirect['query'] = remove_query_arg('cat', $redirect['query']); 
    131         } elseif ( is_author() && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) { 
     131        } elseif ( is_author() && !empty($_GET['author']) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) { 
    132132            $author = get_userdata(get_query_var('author')); 
    133133            if ( false !== $author && $redirect_url = get_author_posts_url($author->ID, $author->user_nicename) ) 
Note: See TracChangeset for help on using the changeset viewer.