Support

Account

Home Forums General Issues Query Posts by User ACF Field Reply To: Query Posts by User ACF Field

  • There isn’t any way that you can do this with one query because you are adding locations to users. I’m not even sure you could do it in one query if you were adding users to locations.

    Locations added to users

    1. Get users
    2. Loop through users to get figure out who is at a the location and compile a list/array
    3. Query posts by users

    Users added to locations, this would be easier

    1. get location post
    2. Get list of authors from location
    3. query posts by list of authors

    Due to the way relationship fields are stored (this includes, relationship, taxonomy, user and any field that relates one WP object to another) as serialized arrays, and the fact that you can’t really query across multiple types of WP objects (multiple post types or users/post types) there isn’t going to be a way to do this with just a WP_Query and you’re going to need to do some kind of extra work and more than likely multiple queries to make it happen.