Help with Filtering FAQs by Two Taxonomies on Archive Pages

Hi everyone,

I’m currently working on a FAQ system in WordPress using Loops and Logic, and I need some guidance to accomplish my goal. The system is built with a custom post type and two custom taxonomies, and while I have some functionality working, I’m struggling with implementing a specific query to filter the posts as needed.

My web page is located here:

Project Overview:

  • Custom Post Type: loan-faq
  • Taxonomy 1: faq-topic (topics like “Auto Loan FAQs”, “Used Car Loan FAQs”)
  • Taxonomy 2**: faq-type (question types like faq, saq, maq)

My Goal:

I need to display FAQ posts on a taxonomy archive page filtered by:

  1. The current faq-topic term (based on the taxonomy archive page I’m viewing).
  2. The faq-type taxonomy to show only posts tagged with the faq term (or saq/maq in other sections).

Current Working Setup:

I have the accordion structure working for the FAQ section using this snippet:

The Issue:

I need to modify the query so that:

  1. It filters posts by the current faq-topic taxonomy term (from the taxonomy archive page).
  2. It also filters posts by the faq-type taxonomy term (specifically faq for one section, and later saq and maq for other sections).

What I Tried:

I attempted the following query, but it’s not filtering as expected:

What I Need Help With:

  1. How can I properly filter posts based on both the current faq-topic term and the faq-type term?
  2. Is there a better approach to handling multiple taxonomy filters in Loops and Logic?
  3. Do you have any suggestions on how to optimize or improve this setup?

Thanks in advance for any help or insight the community can provide!

This is a way to filter the faq based on a specific taxonomy term

<Note>FAQ Type</Note>
<ul>
  <Loop type=loan-faq taxonomy="faq-type" taxonomy_compare="in" terms="faq">
    <li><Field title /></li>
  </Loop>
</ul>
<Note>FAQ Topic</Note>
<ul>
  <Loop type=loan-faq taxonomy="faq-topic" taxonomy_compare="in" terms="auto-loan">
    <li><Field title /></li>
  </Loop>
</ul>
<Note>FAQ Type And Topic</Note>
<ul>
  <Loop type=loan-faq taxonomy="faq-type" taxonomy_compare="in" terms="faq" taxonomy_2="faq-topic" taxonomy_compare_2="in" terms_2="auto-loan">
    <li><Field title /></li>
  </Loop>
</ul>

You can also filter the faqs based on the faq-type and faq-topic of the current faq post. The exclude=“current” is excluding the current post in the faq list but if you still want the current faq to be added you just need to remove the exclude=“current” in the query

<List name=faq-type-list>
  <Loop type=taxonomy_term taxonomy="faq-type" post=current>
    <Item><Field id /></Item>
  </Loop>
</List>
<List name=faq-topic-list>
  <Loop type=taxonomy_term taxonomy="faq-topic" post=current>
    <Item><Field id /></Item>
  </Loop>
</List>
<ul>
  <Loop type=loan-faq taxonomy="faq-type" taxonomy_compare="in" terms="{Get list=faq-type-list}" taxonomy_2="faq-topic" taxonomy_compare_2="in" terms_2="{Get list=faq-topic-list}" exclude="current">
    <li><Field title /></li>
  </Loop>
</ul>