WP_Query Multiple Relationships relation = AND doesn't work ?

Support MB Relationships WP_Query Multiple Relationships relation = AND doesn't work ?Resolved

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #24662
    JulienJulien
    Participant

    Hi,

    since yesterday I tried to make a WP_Query with 2 relationship with a AND relation.

    Here is the content of the array of my query.

    Array
    (
        [post_type] => recipe
        [paged] => 1
        [posts_per_page] => 9
        [relationship] => Array
            (
                [0] => Array
                    (
                        [id] => recipes_to_brands
                        [to] => 75
                    )
    
                [1] => Array
                    (
                        [id] => cheeses_to_recipes
                        [from] => 73
                    )
    
                [relation] => AND
            )
    
    )
    

    With that, no result.

    If I exclude one of the two relation, I have my result.

    So with

    Array
    (
        [post_type] => recipe
        [paged] => 1
        [posts_per_page] => 9
        [relationship] => Array
            (
                [0] => Array
                    (
                        [id] => recipes_to_brands
                        [to] => 75
                    )
    
                [relation] => AND
            )
    
    )

    And

    Array
    (
        [post_type] => recipe
        [paged] => 1
        [posts_per_page] => 9
        [relationship] => Array
            (
                [0] => Array
                    (
                        [id] => cheeses_to_recipes
                        [from] => 73
                    )
    
                [relation] => AND
            )
    
    )

    I have each time the same post found.

    If I replace AND by OR, my result is found but I don't want to use an OR 😉

    Wordpress Core, Metabox and Meta Box Aio are on last version.

    #24668
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I will check this case and let you know later.

    Thank you.

    #24671
    JulienJulien
    Participant

    Hello,

    thanks,

    I did a video record with a quick sample test code.

    https://www.youtube.com/watch?v=0gqSSPWWUZ4
    https://gist.github.com/harkor/23a53e40a53908d6de98d505241cc6a8

    Thank you

    #24815
    JulienJulien
    Participant

    Hello,

    have you been able to look at this ?

    Sorry to insist but it's a little bit problematic for me.

    #27156
    JulienJulien
    Participant

    Hi,

    1 month since my last answer.

    Any news ?

    #27166
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I've added this case to the backlog development, I will get back to you if I have any information.

    #28909
    LeerpodiumLeerpodium
    Participant

    Hi, we have this exact same problem.
    Do you have an update regarding this issue?

    #28912
    Cereal ConceptCereal Concept
    Participant

    Hi !

    I have the same problem.
    Works well with OR but not with AND

    Can you look into it when you have more time ?

    Thanks !

    #29104
    JulienJulien
    Participant

    I discover this issue since 18 february and still any fix...

    Why is so long ?

    #29107
    Long NguyenLong Nguyen
    Moderator

    Hi friends,

    We are working tirelessly on this issue. Please check the commits in the repository https://github.com/wpmetabox/mb-relationships/commits/master

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.