Home › Forums › Front-end Issues › Create a filter by repeater sub field › Reply To: Create a filter by repeater sub field
Hi @leyzaola
The relationship field saves the data as serialized IDs of the post objects. To learn more about serialize, please take a look at this page: http://php.net/manual/en/function.serialize.php.
To search only the ID, I believe you can do it like this:
$args = array(
'numberposts' => -1,
'post_type' => 'noticias',
'meta_query' => array(
array(
'key' => 'cobertura_%_pais',
'compare' => '=',
'value' => '"' . $pais . '"',
)
)
);
To learn more about querying relationship field, please take a look at this page: https://www.advancedcustomfields.com/resources/querying-relationship-fields/.
Also, “_location_1_country” is a reference key used by ACF to save and load the right value, so you don’t need to worry about it.
I hope this helps 🙂
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.