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:
parent
991bd96fb6
commit
358336546e
|
@ -212,7 +212,7 @@ class WC_Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for verbose page rules
|
// 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( 'post_type', 'product' );
|
||||||
$q->set( 'page', '' );
|
$q->set( 'page', '' );
|
||||||
$q->set( 'pagename', '' );
|
$q->set( 'pagename', '' );
|
||||||
|
|
Loading…
Reference in New Issue