Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts

i had a similar issue, where i wanted to show different subcartegories inside a main category

  • shoes
  • men
    • shoes men
  • women
    • shoes women

so inside shoes i wanted to show both men and women shoes whilst non of these items should be required to be in category shoes..

your tax_query might be correct but you have to look inside your query for more query variables.

use echo '<pre>', print_r( $query ), '</pre>'; inside your pre_get_posts function.

in my case, the very first entry was [product_cat] => shoes so i wrote unset( $query->query_vars['product_cat'] ); to remove that entry, and that worked on my end.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)