Question

I'm filtering the main query of Jigoshop with my own taxonomy with this hook (The file responsible for Jigoshop queries that I'm hooking, Jigoshop hooks onto WP 'request' filter):

add_filter( 'loop_shop_tax_query', 'my_loop_shop_tax_query', 11 );
function loop_shop_tax_query( $request )
{
    $region = 'dublin';
    if ( ! empty( $region ) ) {
        $request[] = array(
            'taxonomy'  => 'product_region',
            'field'     => 'slug',
            'terms'     => $region,
            'operator'  => 'IN',
        );
    }

    return $request;
}

I want to filter every Jigoshop query this way (all products display, category display & search display). This is working as intended but wp_title() in the html head is causing the error:

Notice: Undefined property: stdClass::$labels in /var/www/wp/wp-includes/general-template.php on line 658

Notice: Trying to get property of non-object in /var/www/wp/wp-includes/general-template.php on line 658

I've tracked this down in general-template.php and is_post_type_archive() is returning true even though get_tax() is also returning true. get_queried_object() is returning my taxonomy object (normally the Jigoshop product custom post type object).

I need get_queried_object() to still return the Jigoshop product custom post type object and get_tax() should return false, I want to filter the posts with my taxonomy but I want to keep displaying a post type archive (is this even possible?)

Just before the request is sent back to WP for 'request' filter, it looks like this:

Array ( [post_type] => product [post_status] => publish [posts_per_page] => 12 [orderby] => post_date [order] => asc [tax_query] => Array ( [relation] => AND [0] => Array ( [taxonomy] => product_region [field] => slug [terms] => dublin [operator] => IN ) ) [meta_query] => Array ( [0] => Array ( [key] => visibility [value] => Array ( [0] => visible [1] => catalog ) [compare] => IN ) ) [post__in] => Array ( [0] => 293 [1] => 291 [2] => 289 [3] => 18 [4] => 0 ) )

I hope this isn't too specific and makes sense, I'm really at my wit's end here, any help would be greatly appreciated.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top