P2P between 2 CPTs issue – Create connection show only from "Post" type.
-
Hello,
I have an issue using P2P to connect 2 different CPTs. I tried to connect between ‘person’ and ‘directory’. But the search box (when editing the post_type, say person) only show list of Post, rather than the actual CPT. This is my code:
function my_connection_types() {
p2p_register_connection_type( array(
‘name’ => ‘posts_to_pages’,
‘from’ => ‘person’,
‘to’ => ‘directory’,
) );
}
add_action( ‘p2p_init’, ‘my_connection_types’ );And when I tried to create the connection anyway, the error came up as “Invalid second parameter.”
If I go edit a “person” post, shouldn’t the search box display all “directory” posts instead of the “post” posts?
I did some test by changing ‘to’ => ‘directory’, to ‘to’ => ‘page’, and it still the same issue.
Only if I change the post_type in “to” post or user then it work normally (display and connect correctly).
Did I do something wrong?
Note: the CPT I created with Types plugin.
Thanks for your help in advance!
- The topic ‘P2P between 2 CPTs issue – Create connection show only from "Post" type.’ is closed to new replies.