Support

Account

Home Forums Backend Issues (wp-admin) Displaying Posts with Multiple Entries in Custom Field Reply To: Displaying Posts with Multiple Entries in Custom Field

  • Sorry, I missed the part about using Elementor.

    To be honest, I don’t know how it is working at all, even when the field has a single entry. Elementor does not work well with relationship fields.

    Elementor is expecting the custom field with a value that is equal to “1”. ACF does not store values like this for a relationship field.

    When ACF stores the relationship with 1 entry and the value is “1” the value in the DB will look like this a:1:{i:0;s:1:"1";} and when ACF stores multiple entries like “1” and “15” it would look like this a:2:{i:0;s:1:"1";i:1;s:2:"15";}

    I can only guess that Elementor is somehow unserializing the single value and seeing it is an array with only one value and using that value correctly but not managing the multiple value return properly.

    Querying posts by a relationship field is not something you can do without adding a custom query. See Querying relationship fields