Support

Account

Home Forums ACF PRO Filter customs posts with relationships Reply To: Filter customs posts with relationships

  • Not sure if you’re using a relationship field or a user field by your description, but either of these are similar. They hold an array of IDs to either posts or users. There is no way to filter these easily if you want to select more than one value.

    You should look a the Multiple custom field values (array based values) section of https://www.advancedcustomfields.com/resources/query-posts-custom-fields/.

    As these are ID values what you see in the example here

    
    array(
      'key' => 'location',
      'value' => 'Melbourne',
      'compare' => 'LIKE'
    ),
    

    Should be replaced by something like

    
    array(
      'key' => 'location',
      'value' => '"'.$ID.'"',
      'compare' => 'LIKE'
    ),
    

    as in the single-location.php section of https://www.advancedcustomfields.com/resources/querying-relationship-fields/