[wp-trac] [WordPress Trac] #18114: is_home erroneously returns true for queries on non-public post types

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 9 17:33:14 UTC 2011


#18114: is_home erroneously returns true for queries on non-public post types
--------------------------+------------------------------
 Reporter:  batmoo        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  3.2
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by nacin):

 This is more or less proper behavior. is_home is the default fallback
 whenever you wish to add on query vars that don't otherwise change the
 flags.

 This is the purpose of has_archive for a custom post type -- you can still
 query a post type when has_archive is set to false, but it'll then get
 is_home.

 If you want to affect the front page, you'll probably want to use
 is_front_page, or you should be checking wp_query against the original
 query object (wp_the_query) to make sure you're operating on the main
 loop.

 I'm not sure how this should be addressed, other than the way to run a
 query that actually discards any kind of flags from being set. I don't
 think I like that behavior.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18114#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list