[wp-trac] [WordPress Trac] #14355: is_front_page returns false - if used after the loop starts

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 20 19:48:56 UTC 2010

#14355: is_front_page returns false - if used after the loop starts
 Reporter:  christian_gnoth    |        Owner:         
     Type:  defect (bug)       |       Status:  closed 
 Priority:  normal             |    Milestone:         
Component:  General            |      Version:  3.0    
 Severity:  normal             |   Resolution:  invalid
 Keywords:  reporter-feedback  |  
Changes (by nacin):

  * status:  new => closed
  * resolution:  => invalid
  * milestone:  Awaiting Review =>


 I can't reproduce anything with that code per se, but it is obvious why
 is_front_page is returning two different values. Between calls, you call
 query_posts(), which resets the query object and changes all of the
 conditionals to reflect the new query.

 If you don't want to alter things that low-level, then using get_posts or
 a new WP_Query will suffice.

 Also, if you're going to use `$_SERVER['PHP_SELF']`, better not to use it,
 but if you do, then make sure you escape it.

Ticket URL: <http://core.trac.wordpress.org/ticket/14355#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list