Hi,
I would like to sort loop items by the value of a number field in a nested group (2 levels down).
I can sort by top-level fields without problems but not by nested subfields.
Something like this obviously doesn't work:
{% set args =
{
post_type: 'my-cpt',
posts_per_page: -1,
meta_key: 'my_group.my_group_2.my_subfield',
orderby: 'meta_value',
order: 'ASC',
}
%}
{% set posts = mb.get_posts(args) %}
Using only 'my_subfield' doesn't work either.
I also tried to sort using Twig's "|sort":
{% set sortorder = '' %}
{% for post in posts|sort((a, b) => a.sortorder <=> b.sortorder) %}
{% set sortorder = post.my_group.my_group2.my_subfield %}
But that won't work, either.
How can I sort by a nested subfield?
Greetings,
Tom