NO BUG: Global element with a Query loop not working as previously

Browser: Chrome 110
OS: Windows

After updating from 1.11.1 to 1.12.1 I noticed that one of my query loops was outputting all terms instead of the terms I had filtered in the query editor. The query loop is on a global element and after unlinking the global element, it worked as previously.

Not sure the query is relevant particularly, but it was type “Terms” and in the “Query Editor (PHP)”:

return [
  'taxonomy' => 'service_category',
  'term_taxonomy_id' => get_root_taxonomy_term_ids( 'service_category' ),
  'meta_query' => [
    [
      'key' => 'logo',
      'value' => '',
      'compare' => '!='
    ],
  ],
];

The get_root_taxonomy_term_ids function is whitelisted and the code signed.

Hi Jamie,
Thanks so much for your report!

Which element is it? Can you please attach a screenshot showing your structure panel?

Best regards,
timmse

Hi timmse

It was the element highlighted here in the structure panel. For now, I have just unlinked it so that it’s no longer a global element to resolve it.

Thanks
Jamie

Hi Jamie,
Thanks for the screenshot!

I had already suspected that you were using a nestable element as a “global” element, which is not the correct use case (see academy) and most likely led to the issue (even if it worked before).

We are adding to the confusion because the “global element” option is there, even for nestable elements that can contain children. However, we will soon deprecate global elements as stated in the “Components” academy article.

It is, therefore, advisable to avoid using global elements from now on (unlink/convert them). You have two options:

  1. you save your “Root Service Category Loop” as a section template, and select it within the "template element“ (see academy)
  2. turn it into a component, which is a valid (currently experimental) replacement for the global elements and can be used on any element

Best regards,
timmse

Hi timmse

I won’t use them in future, but just to be clear I’m not wanting or expecting to save the element’s children. I have a global element which I have added a child to (which happens to be a global element, too). The parent is really only a global so I don’t have to repeat the custom query.

Thanks
Jamie