Title: [Plugin: Posts 2 Posts] Retrieve the post_meta
Last modified: August 20, 2016

---

# [Plugin: Posts 2 Posts] Retrieve the post_meta

 *  Resolved [mosabua](https://wordpress.org/support/users/mosabua/)
 * (@mosabua)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-retrieve-the-post_meta/)
 * Hi
 * first of all thanks for the awesome plugin. There is just one thing that I can’t
   get to work – I simply want to display some custom fields from the connected 
   post type.
 * That’s the code I tried:
 *     ```
       <?php
       $connected = new WP_Query( array(
       'post_type' => 'person',
       'connected' => get_queried_object_id()
       ) );
       echo '<ul>';
       while( $connected->have_posts() ) : $connected->the_post();
       echo '<li>';
       the_title();
       echo get_post_meta(get_the_ID(), 'email', true);
       echo '</li>';
       endwhile;
       echo '</ul>';
       wp_reset_postdata();
   
       ?>
       ```
   
 * … it’s that get_post_meta thing …
 * thanks werner
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-retrieve-the-post_meta/#post-2249992)
 * It works for me.
 * get_the_ID() returns consecutive ‘person’ ids.
 *  Thread Starter [mosabua](https://wordpress.org/support/users/mosabua/)
 * (@mosabua)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-retrieve-the-post_meta/#post-2250039)
 * It’s working here as well – the problem was that I had to update the person in
   the backend …

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Posts 2 Posts] Retrieve the post_meta’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/posts-to-posts_7a8e9d.svg)
 * [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/posts-to-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/posts-to-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/posts-to-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/posts-to-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/posts-to-posts/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [mosabua](https://wordpress.org/support/users/mosabua/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-retrieve-the-post_meta/#post-2250039)
 * Status: resolved