[wp-trac] [WordPress Trac] #25143: Appending registered query vars to home URL sets is_home to true when should be false

WordPress Trac noreply at wordpress.org
Sun Aug 25 21:32:34 UTC 2013


#25143: Appending registered query vars to home URL sets is_home to true when
should be false
--------------------------+--------------------------------------
 Reporter:  mordauk       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  3.6
 Severity:  normal        |   Keywords:  dev-feedback needs-patch
--------------------------+--------------------------------------
 I think I've discovered a bug with how custom query vars are handled on
 the home page.

 Assume your site is `http://yoursite.com` and you have a query var called
 `foo` registered with the `query_vars` filter, and the front page is set
 to a static page.

 Going to `http://yoursite.com` loads the front page as expected and shows
 the contents of the static page.

 Going to `http://yoursite.com/?foo=1` loads the front page but instead of
 showing the contents of the static page, it acts like the blog page and
 loads the posts list.

 I haven't tracked it down fully, but I believe it's because `is_home` is
 improperly set to `true` in query.php. `is_page` is also incorrectly set
 to false I think.

 To reproduce:

 1. Enable pretty permalinks
 2. Set the front page to a static page
 3. Register a query var:

 {{{
 function foo_query_vars( $vars ) {
         $vars[] = 'foo';
         return $vars;
 }
 add_filter( 'query_vars', 'foo_query_vars' );
 }}}
 4. Go to http://yoursite.com - This will work correctly
 4. Go to http://yoursite.com/?foo=1 - This will be incorrect

 Note, this only happens if the query var is registered with WP.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25143>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list