[wp-trac] [WordPress Trac] #18114: is_home erroneously returns true for queries on non-public post types (was: is_home erroneously returns true for nav menu queries)
WordPress Trac
wp-trac at lists.automattic.com
Fri Sep 9 06:22:21 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 solarissmoke):
I believe this problem isn't just limited to nav menu queries: it happens
when you limit any query to post types that are not publicly queryable
(which includes `nav_manu_item`). The following line in `query.php` will
always be true in such cases:
{{{
if ( !( $this->is_singular || $this->is_archive || $this->is_search ||
$this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin
|| $this->is_comments_popup || $this->is_robots ) )
$this->is_home = true;
}}}
because none of those other vars will be true.
I think the problem is that the logic used to determine `is_home()` is
negative, i.e., it checks all other known possibilities and if none match
then it assumes we are at the home page. The problem is that with non-
public post types this is not always the case.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18114#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list