I am having an issue with the Post Query Loop when trying to display “Related Products” sharing the same custom taxonomy on a Single Product page.
Note: The Custom Post Type and Custom Taxonomy are created via Meta Box.
Here is my current Query Loop setup in Bricks:
-
Query type: Posts
-
Post type: Ring product (CPT via Meta Box)
-
Disable query merge: On
Taxonomy Query Settings:
-
Relation: AND
-
Taxonomy: product Categories (Custom taxonomy via Meta Box, slug:
fring-product-category) -
Field:
term_id -
Terms:
{post_terms_fring-product-category:term_id}
The Problem:
When using the setup above, the query returns no results (empty).
However, if I output {post_terms_fring-product-category:term_id} as plain text on the page, it successfully displays the correct numerical Term ID (e.g., 15).
Even weirder, if I change the Taxonomy Query settings to Field: name and Terms: {post_terms_fring-product-category}, the query works perfectly and returns the related products.
My Analysis:
It seems that when the Meta Box taxonomy dynamic tag {post_terms_...:term_id} is passed into the Terms input field of the Query Loop, it is not being processed as a pure, clean integer. Instead, it might be passed as an array or a string format that fails WordPress’s strict integer matching for term_id, causing the database query to fail.
Could you please look into this data format mismatch issue between Bricks Query Loop and Meta Box taxonomies? Using Field: term_id is the standard and most performant way for database queries, and it should work seamlessly with the :term_id dynamic tag modifier.
Looking forward to your reply.
Best regards,
wilson
