Support

Account

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 🙂