I think you need to elaborate on what you’re trying to achieve.
At face value you don’t need connection metadata, you just need to create a “normal” connection where either the “from” or “to” value is custom_post_name.
Ted
When you say custom_post, you mean a list of certain posts not a post type?
Anyway, here is an example where I populated a dropdown with custom values, as that is what it seems that you want to do (for some reason).
Instead of using $product_category_terms = get_terms(‘product_category’, $args) you could use a WP post query, get the posts you like included and then they will show up in the dropdown. But it’s a simple dropdown, not a fancy search field.
function my_connection_types() {
$args = array(
'hide_empty' => false,
'fields' => 'names'
);
$product_category_terms = get_terms('product_category', $args);
p2p_register_connection_type( array(
'name' => 'products_to_projects',
'from' => 'product',
'to' => 'project',
'fields' => array( // this creates extra meta fields that can be added to a connection - use to distinguish between connections by meta
'product_type' => array(
'title' => 'Product Type',
'type' => 'select',
'values' => $product_category_terms
),
'count' => array(
'title' => 'Count',
'type' => 'text',
)/*,
'role' => array(
'title' => 'Role',
'type' => 'select',
'values' => array( 'engineer', 'support', 'manager' )
),*/
),
) );