WP_Query Multiple Relationships relation = AND doesn't work ?
Support › MB Relationships › WP_Query Multiple Relationships relation = AND doesn't work ?Resolved
- This topic has 9 replies, 4 voices, and was last updated 4 years, 4 months ago by Long Nguyen. 
- 
		AuthorPosts
- 
		
			
				
February 28, 2021 at 4:42 PM #24662Julien ParticipantHi, 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. March 1, 2021 at 3:29 PM #24668Long Nguyen ModeratorHi, I will check this case and let you know later. Thank you. March 1, 2021 at 4:18 PM #24671Julien ParticipantHello, thanks, I did a video record with a quick sample test code. https://www.youtube.com/watch?v=0gqSSPWWUZ4 
 https://gist.github.com/harkor/23a53e40a53908d6de98d505241cc6a8Thank you March 10, 2021 at 3:48 PM #24815Julien ParticipantHello, have you been able to look at this ? Sorry to insist but it's a little bit problematic for me. April 11, 2021 at 11:35 PM #27156Julien ParticipantHi, 1 month since my last answer. Any news ? April 12, 2021 at 6:08 AM #27166Long Nguyen ModeratorHi, I've added this case to the backlog development, I will get back to you if I have any information. June 15, 2021 at 4:46 PM #28909Leerpodium ParticipantHi, we have this exact same problem. 
 Do you have an update regarding this issue?June 15, 2021 at 8:34 PM #28912Cereal Concept ParticipantHi ! I have the same problem. 
 Works well with OR but not with ANDCan you look into it when you have more time ? Thanks ! June 24, 2021 at 4:24 PM #29104Julien ParticipantI discover this issue since 18 february and still any fix... Why is so long ? June 24, 2021 at 6:39 PM #29107Long Nguyen ModeratorHi friends, We are working tirelessly on this issue. Please check the commits in the repository https://github.com/wpmetabox/mb-relationships/commits/master 
- 
		AuthorPosts
- You must be logged in to reply to this topic.