Hi Long,
thanks for your answer. I'm probably doing something wrong, because the result isn't filtered:
$connected = new WP_Query( [
'relationship' => [
'id' => 'fromdatestovenues',
'to' => get_the_ID(),
'meta_key' => 'wochentag_select',
'meta_value' => $dertag,],
'nopaging' => true,
] );
doesn't show any posts:
$connected = new WP_Query( [
'relationship' => [
'id' => 'fromdatestovenues',
'to' => get_the_ID(),
],
'meta_key' => 'wochentag_select',
'meta_value' => $dertag,
'nopaging' => true,
] );
Is it relevant that the custom field is not in the post I'm running the query from, but in the post with the relationship?
In Views (Singleview) the working query is:
{% for post in relationships.fromdatestovenues.from|filter(post => post.wochentag_select.name == dertag or post.wochentag_select.name == heute)|sort((a, b) => b.wochentag_select <=> a.wochentag_select ?: a.startzeit <=> b.startzeit) %}
But I have to rewrite it to php.