WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using the amazing P2P plugin (many thanks Scribu!) and I am having an issue that is probably right in front of my face but I just can't see.

I have a 'People' as CPT and I have connected that to 'Users' with a 'Person_to_User' connection I created.

On single posts I want to get the connected 'person' in my 'People' CPT from that post author.

It seems like that should be fairly simple to do but my brain is hurting from trying to get this and I can't spend much more time on this.

share|improve this question
up vote 0 down vote accepted

On single post, try something like this:

$author_id = get_the_author_meta('ID');

$people = get_posts( array(
  'connected_type' => 'people_to_user', // replace with whatever
  'connected_items' => $author_id,
  'suppress_filters' => false,
  'nopaging' => true
) );

Now $people[0] references the first (and only) author related to the post you're on. So $people[0]->ID can be used to get the various bits of content, thumbnail, custom meta, etc.

share|improve this answer
Yes! Thank you so much GhostToast! I would buy you a beer sir if I could. Best. – WP Loopy Jul 1 '13 at 23:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.