Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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.