I try create query to get related products.
From this tutorial: https://www.youtube.com/watch?v=_9nCps8EeHM
Every works fine, but not to categories which contains “comma” into name.
As a result of the error, the products are not displayed.
I use filter to display query vars.
As You can see category name is changed.
Comma and everything on the right side is removed.
If I change comma to dot, or remove comma, everything works fine.
This is because the comma will be treated as a different term when used in the tax_query.
Unfoturnetaly, {post_terms_xxx} will use the category name instead of slug or ID.
We will discuss internally so you can output slug or ID when using this dynamic tag.
As a workaround, you can add this function in your child theme and add into echo white list, then use {echo:get_current_post_term_ids('product_cat')} inside the taxonomy query like this