[wp-trac] [WordPress Trac] #21096: Filter on is_front_page return value
WordPress Trac
wp-trac at lists.automattic.com
Thu Jun 28 11:43:15 UTC 2012
#21096: Filter on is_front_page return value
--------------------------+------------------------------
Reporter: CoenJacobs | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: dev-feedback |
--------------------------+------------------------------
Comment (by mikejolley):
In our pre_get_posts query where we set the frontpage as the post type
archive we have to set some conditionals for it to work:
{{{
$q->is_page = false;
$q->is_singular = false;
$q->is_post_type_archive = true;
$q->is_archive = true;
}}}
Making is_page true gives us all kinds of errors such as
{{{
Notice: Undefined property: stdClass::$ID in
/nfs/c08/h03/mnt/125403/domains/woocommerce.faultpress.com/html/wp-
includes/query.php on line 3349
}}}
Possibly due to the fact we need to unset the page_id to get the post type
query working:
{{{
$q->set( 'post_type', 'product' );
$q->set( 'page_id', '' );
}}}
Being able to simply set $q->is_front_page = true; would be another
workaround (instead of the filter) but agree it would be better to have a
fixed is_front_page() function.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21096#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list