Home › Forums › Front-end Issues › Query posts by user relationship field › Reply To: Query posts by user relationship field
I also have this issue and believe it to be a bug with ACF. I have a created a bidirectional relationship between two post types using two relationship fields. I have been querying these fields using WP_Query as you would normally wrapping the value (in this case a post ID) with double quotes.
However customers have told me that the query is not selecting the correct number of posts. When I looked into this I noticed that sometimes the array values are not being saved with double quotes within the serialised array. See screenshot of phpmyadmin.
Any ideas on what could be causing this would be great, it’s bringing me great stress and frustration at the moment.
Also, @hube2 as a work around I wondered if I could query both
'"' . $post_ID . '"' as you would normally but also
':' . $post_ID . ';' or am I likely to run into issues with selecting the wrong posts due to the numbers in the serialised array?
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.