Support

Account

Home Forums Add-ons Repeater Field Query with tax and repeater sub field relation

Solving

Query with tax and repeater sub field relation

  • Hi,

    With the help of forums, videos etc I have been trying to implement this for countless hours, but I seem to be missing something fundamental. I am really hoping for your help.

    I have two CPT, Translators and Translations. The Translations have taxonomies for different languages. The Translations have a Repeater field where I access the Translator with a Post-Object field, among other things. The repeater field is because a translation can have several languages.

    I have managed (with your help, among other things) to make a list of the translations with the corresponding translators and this works fine.

    Now I have to do this the other way round, i.e. a list of translators with the corresponding translations that this translator has made.

    I have tried countless variations, most recently with a meta_query and

    
    <?php
    $args = [
    'post_type' => 'translation',
    'meta_query' => array(
    array(
    'key' => 'translator_name',
    'value' => get_the_ID(),
    'compare' => '='
    )
    )
    ];
    
    $translations_by_translators = get_posts( $args );
    ?>

    The translator_name field is currently set to return a post object, but it didn’t make any difference whether it was a post ID or post object.

    I am aware that I am probably making it too simple with the code above and that the solution looks a bit more complex.

    Thank you very much for your help!
    Adriano

  • The solution is a lot more complex because your translator name field is in a repeater.

    See the section on this page about Sub custom field values

    Personally I would find another way

  • Thank you very much for your advice! I see that the problem is indeed rather complex and I need to delve into it a bit. If I find a concrete solution, I will be happy to post it here.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.