Title: [Plugin: Posts 2 Posts] Connection between custom post type and attachment.
Last modified: August 20, 2016

---

# [Plugin: Posts 2 Posts] Connection between custom post type and attachment.

 *  [letusrise](https://wordpress.org/support/users/letusrise/)
 * (@letusrise)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-connection-between-custom-post-type-and-attachment/)
 * By the way, what a great plugin bro, scribu! It’s really useful when it comes
   to relating posts. This should be put in the WordPress core.
 * Connection between custom post type and attachment.
 * Is this possible? I’ve tried to connect my custom post type named “person” to“
   attachment”. I wasn’t able to see the box in the attachment.
 * The idea was to connect custom post type “person” to “attachment”.
    Why? – I 
   want to connect it, because I want to add connection who is in the photo like
   for example.
 * Example:
    I uploaded a photo in attachment. – People who are in the photo are
   Person A, Person B and Person C. Connecting it from “person” to “attachment”.
 * Additional Question: Bro, can Post 2 Post plugin handle 10,000 posts with 100,000
   + more connections? (If you have a good server though.)
 * Thanks and God Bless!
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

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

 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-connection-between-custom-post-type-and-attachment/#post-2361505)
 * I can definitely see how using P2P for attachments would be useful, given that
   an attachment can only have one parent.
 * > Is this possible? I’ve tried to connect my custom post type named “person” 
   > to “attachment”. I wasn’t able to see the box in the attachment.
 * It’s possible, but you’ll only see the box when editing a ‘person’ post type.
   See [https://github.com/scribu/wp-posts-to-posts/issues/36](https://github.com/scribu/wp-posts-to-posts/issues/36)
 * > Can Post 2 Post plugin handle 10,000 posts with 100,000+ more connections? (
   > If you have a good server though.)
 * Yep; see [https://github.com/scribu/wp-posts-to-posts/wiki/Data-organization](https://github.com/scribu/wp-posts-to-posts/wiki/Data-organization)
 *  Thread Starter [letusrise](https://wordpress.org/support/users/letusrise/)
 * (@letusrise)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-connection-between-custom-post-type-and-attachment/#post-2361507)
 * Wow, cool. Thanks so much for your immediate response!
 * Bro, can I have another question?
 *     ```
       $thequerydirector = new WP_Query( array(
          'post_type' => 'person',
          'connected' => $post->ID,
          'connected_meta' => array(
            'role_type' => 'director' )
          )
         );
         echo '<ul>';
         echo '<li><strong>Director:</strong> ';
         while( $thequerydirector->have_posts() ) : $thequerydirector->the_post();
          $permalink = get_permalink();
          $thetitle = get_the_title();
          $directors = '<a href="' . $permalink . '">' . $thetitle . '</a>';
          $wdirectors =  '<a href="' . $permalink . '">' . $thetitle . '</a>';
   
          echo $wdirectors;
   
         endwhile;
          echo '</li>';
         wp_reset_query();
       ```
   
 * Is there a better way of improving this? Also, I want it to do like “foreach”
   because I want to add comma to each custom post type “person” connected as director.
 * Like for example.
 * Directors: Person A, Person B, Person C
 * Thanks and God Bless!
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-connection-between-custom-post-type-and-attachment/#post-2361514)
 * [https://github.com/scribu/wp-posts-to-posts/wiki/Looping-The-Loop](https://github.com/scribu/wp-posts-to-posts/wiki/Looping-The-Loop)
 * Please read all the tutorials in the wiki before asking any more questions, ok?

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

The topic ‘[Plugin: Posts 2 Posts] Connection between custom post type and attachment.’
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/)

 * 3 replies
 * 2 participants
 * Last reply from: [scribu](https://wordpress.org/support/users/scribu/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-connection-between-custom-post-type-and-attachment/#post-2361514)
 * Status: not resolved