Home › Forums › General Issues › Multiple (pluralized) relationships in a single query › Reply To: Multiple (pluralized) relationships in a single query
First, the value in the DB is not a JSON value, it is a serialized array, but that does not matter.
In order to get all posts with a value, first you need to know the post ID of the value you’re looking for, then using this value you need to do a WP_Query to get the posts.
I’m only including the meta_query portion of the query args
'meta_query' => array( 'relation' => 'OR', array( 'key' => 'board_game', 'value' => $post_id 'compare' => '=' ), array( 'key' => 'board_games', 'value' => '"'.$post_id.'"', 'compare' => 'LIKE' ) )
see https://developer.wordpress.org/reference/classes/wp_query/, https://www.google.com/search?client=firefox-b-1-d&q=acf+query+by+custom+field and https://www.advancedcustomfields.com/resources/querying-relationship-fields/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!