Support

Account

Home Forums Add-ons Repeater Field Repeater vs Select Multiple Values Reply To: Repeater vs Select Multiple Values

  • If you want to do queries based on these values then both are problematic using WP_Query.

    A user field stores a serialized array of user IDs. To query this field you would need to to a “LIKE” meta_query 'value' => '"'.$id.'"', 'compare' => 'LIKE'. This is not a big problem if you want to query by a single user, but if you want to query by several users at the same time then you’ll need multiple meta values, on for each user. Depending on how many users you’re trying to search for at the same time this could significantly impact the performance of your site.

    Repeaters are even more difficult, there have been several discussions here and elsewhere about querying by repeater sub fields. I’m not even going to go into it because, as a rule, I refuse to try to query based on these fields, see my next statement.

    If I needed to build this I would
    1) Built the admin in a way that makes sense for the client that will make it easy for them to add information
    2) In either case I would convert the content of the ACF field into a standard WP custom meta stored the way WP likes it stored in order to make it easier to use WP_Query. This post is about repeaters, but it can be easily applied to a user field or any other type of field that stores information in non-standard ways https://acfextras.com/dont-query-repeaters/