Hello,
I think it is possible. You can create an if
statement to set the relationship arguments. For example:
if (something) {
$relationship = [
'id' => 'post-provider',
'to' => get_the_ID()
];
} else {
$relationship = [
'id' => 'resource-provider',
'to' => get_the_ID()
];
}
then assign the value to the relationship
key
return array_merge( $query_args, array(
'relationship' => $relationship
) );