title: Wordpress get posts[relationship] from users
body: <p>I have a case in which I have 2 custom post types, let's say they are projects and teams. Using Advanced custom fields, I have a relationship field while creating a project and I'm assigning which teams are working on it. (Important: there is no custom field in the teams post type). Later on, I want on single-team, to list all the projects that this team was working on.</p>
  
  <p>The example that Advanced custom fields has is where you have a custom field in the team, not in the project, and I need to do the opposite. (Here is how acf documentation is <a href="https://www.advancedcustomfields.com/resources/querying-relationship-fields/" rel="nofollow noreferrer">https://www.advancedcustomfields.com/resources/querying-relationship-fields/</a>).</p>
  
  <p>I tried doing this, but it doesn't work, it says that I don't post a correct data.</p>
  
  <p>
  
  <pre><code>$team_id = get_the_ID(); 
  
  $posts = get_posts(array(
      'post_type' =&gt; 'projects',
      'orderby'   =&gt; 'teams',
      'post__in'  =&gt; $team_id,
  ));
  </code></pre>