ryanwelcher / advanced-query-loop

WordPress plugin that introduces a Query Loop block variation that can create advanced queries.
87 stars 10 forks source link

Wrong page title for taxonomy term template #48

Closed StreetDog71 closed 6 months ago

StreetDog71 commented 6 months ago

I've came across this problem in a client website and was able to replicate it on a few test websites. Here are the steps:

  1. Create a custom CPT
  2. Create a custom taxonomy to that CPT
  3. Add some terms to this taxonomy
  4. In the Site Editor create a custom template for this taxonomy
  5. Add AQL to the template, and turn "Inherit query from template" on

Following the steps above, when I access any taxonomy term URL, the query results show as expected, but the page title reads Search results for ""

If I follow the exact same steps but use the default Query Loop block, the title will show the taxonomy term name.

Using the Query Monitor plugin, I can see that the following is being used in each scenario:

With AQL: is_archive(), is_tax(), is_search()

With the default Query Loop block: is_archive(), is_tax()

Can you please check if you can reproduced this problem or if I'm doing something wrong?

ryanwelcher commented 6 months ago

Thanks for logging this. I'll see if I can replicate it and get back to you

ryanwelcher commented 6 months ago

I was able to replicate this using TwentyTwentyFour. There was an empty s parameter that was causing the is_search() to be triggered.

I will get a fix in place as soon as I can but in the meantime ( and if you're comfortable with it ) you can change https://github.com/ryanwelcher/advanced-query-loop/blob/trunk/includes/query-loop.php#L98 to

$wp_query = new \WP_Query( array_filter( $filtered_query_args ) );
StreetDog71 commented 6 months ago

Thanks for the quick reply and fix! Btw, great plugin!! ;)

ryanwelcher commented 6 months ago

Thanks and great to "see" you again!