Ignore an empty pagename when correcting is_* for page_on_front requests. Props donalmacarthur, SergeyBiryukov, filosofo. fixes #16002

git-svn-id: http://svn.automattic.com/wordpress/trunk@17162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-12-28 22:34:15 +00:00
parent a92b6663aa
commit b18df57937
1 changed files with 3 additions and 0 deletions

View File

@ -1559,6 +1559,9 @@ class WP_Query {
// Correct is_* for page_on_front and page_for_posts // Correct is_* for page_on_front and page_for_posts
if ( $this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front') ) { if ( $this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
$_query = wp_parse_args($query); $_query = wp_parse_args($query);
// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
if ( isset($_query['pagename']) && '' == $_query['pagename'] )
unset($_query['pagename']);
if ( empty($_query) || !array_diff( array_keys($_query), array('preview', 'page', 'paged', 'cpage') ) ) { if ( empty($_query) || !array_diff( array_keys($_query), array('preview', 'page', 'paged', 'cpage') ) ) {
$this->is_page = true; $this->is_page = true;
$this->is_home = false; $this->is_home = false;