Check specifically for Post IDs in WC Query

The `WP_Query::queried_object_id` property can reference either a post
or a term ID. This way, we ensure that we are check for posts only.
This commit is contained in:
Dominic 2015-09-07 02:17:01 -07:00
parent 991bd96fb6
commit 358336546e
1 changed files with 1 additions and 1 deletions

View File

@ -212,7 +212,7 @@ class WC_Query {
}
// Fix for verbose page rules
if ( $GLOBALS['wp_rewrite']->use_verbose_page_rules && isset( $q->queried_object_id ) && $q->queried_object_id === wc_get_page_id('shop') ) {
if ( $GLOBALS['wp_rewrite']->use_verbose_page_rules && isset( $q->queried_object->ID ) && $q->queried_object->ID === wc_get_page_id('shop') ) {
$q->set( 'post_type', 'product' );
$q->set( 'page', '' );
$q->set( 'pagename', '' );