From 0334c59be2ac8d08cb624f9f748a7da59e0c6f3d Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 17 Nov 2009 21:01:03 +0000 Subject: [PATCH] Fix undefined index notice in canonical. Props dd32. fixes #11057 git-svn-id: http://svn.automattic.com/wordpress/trunk@12202 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/canonical.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index c0ee5fc23c..010e1c5e8b 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -125,10 +125,10 @@ function redirect_canonical($requested_url=null, $do_redirect=true) { } elseif ( is_year() && !empty($_GET['year']) ) { if ( $redirect_url = get_year_link(get_query_var('year')) ) $redirect['query'] = remove_query_arg('year', $redirect['query']); - } elseif ( is_category() && preg_match( '|^[0-9]+$|', $_GET['cat'] ) ) { + } elseif ( is_category() && !empty($_GET['cat']) && preg_match( '|^[0-9]+$|', $_GET['cat'] ) ) { if ( $redirect_url = get_category_link(get_query_var('cat')) ) $redirect['query'] = remove_query_arg('cat', $redirect['query']); - } elseif ( is_author() && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) { + } elseif ( is_author() && !empty($_GET['author']) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) { $author = get_userdata(get_query_var('author')); if ( false !== $author && $redirect_url = get_author_posts_url($author->ID, $author->user_nicename) ) $redirect['query'] = remove_query_arg('author', $redirect['author']);