Title: [Plugin: Posts 2 Posts] Access values in connection field array?
Last modified: August 20, 2016

---

# [Plugin: Posts 2 Posts] Access values in connection field array?

 *  [Twansparant](https://wordpress.org/support/users/twansparant/)
 * (@twansparant)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-access-values-in-connection-field-array/)
 * Hi scribu,
 * First of all; a BIG thank you for this brilliant plugin! This saved me so much
   work. As a matter of fact I think this should be a standard function in WordPress
   4 or whatever 🙂
 * I was wundering how I can access the values in a connection field from a connection
   type? For example, I have the following connection type with the connection field
   called **childtype**:
 *     ```
       $participant_connection = p2p_register_connection_type( array(
               'from' => 'post-type-parent',
       		'to' => 'post-type-child',
       		'fields' => array(
       			'childtype' => array(
       				'title' => 'Type',
       				'values' => array('value1', 'value2', 'value3', 'value4','value5')
       			)
       		)
           ) );
       ```
   
 * Which works great by the way, I get the childtype within the loop like this:
   `
   p2p_get_meta($post->p2p_id, 'childtype', true);`
 * But I want to get all the values from the **childtype->values** array outside
   the loop and use them in a foreach loop. Something like this:
 *     ```
       $terms = p2p_get_meta($connected->childtype->values);
       foreach($terms as $type):
         echo $type->value;
       endforeach;
       ```
   
 * Obviously `$terms = p2p_get_meta(childtype->values);` isn’t working yet, but 
   that’s the idea. How should I access these values?
    Thanks for your time so far!
 * Cheers, Toine

Viewing 16 replies (of 16 total)

[←](https://wordpress.org/support/topic/plugin-posts-2-posts-access-values-in-connection-field-array/?output_format=md)
[1](https://wordpress.org/support/topic/plugin-posts-2-posts-access-values-in-connection-field-array/?output_format=md)
2

 *  Thread Starter [Twansparant](https://wordpress.org/support/users/twansparant/)
 * (@twansparant)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-access-values-in-connection-field-array/page/2/#post-2349370)
 * You are right again! 🙂
    Somehow the ‘suppress_filters’ line was messing up my
   queries. Thanks a lot!

Viewing 16 replies (of 16 total)

[←](https://wordpress.org/support/topic/plugin-posts-2-posts-access-values-in-connection-field-array/?output_format=md)
[1](https://wordpress.org/support/topic/plugin-posts-2-posts-access-values-in-connection-field-array/?output_format=md)
2

The topic ‘[Plugin: Posts 2 Posts] Access values in connection field array?’ is 
closed to new replies.

## Tags

 * [posts-2-posts](https://wordpress.org/support/topic-tag/posts-2-posts/)

 * 16 replies
 * 2 participants
 * Last reply from: [Twansparant](https://wordpress.org/support/users/twansparant/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-access-values-in-connection-field-array/page/2/#post-2349370)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
