-
Notifications
You must be signed in to change notification settings - Fork 263
p2p_register_connection_type
scribu edited this page Mar 5, 2013
·
1 revision
p2p_register_connection_type() is the function you use to - you guessed it - register a connection type. See Basic usage for a quick example.
It accepts a single parameter, which should be an associative array. Here are all the keys that are recognized:
-
'name'-stringA unique identifier for this connection type. -
'from'-string|arrayThe first end of the connection: post type name or 'user' -
'from_query_vars'-arrayAdditional query vars to pass to WP_Query. Default: none. -
'to'-string|arrayThe second end of the connection: post type name or 'user' -
'to_query_vars'-arrayAdditional query vars to pass to WP_Query. Default: none. -
'fields'-array( key => Title )Metadata fields editable by the user. Default: none. -
'cardinality'-stringHow many connection can each post have: 'one-to-many', 'many-to-one' or 'many-to-many'. Default: 'many-to-many' -
'duplicate_connections'-boolWhether to allow more than one connection between the same two posts. Default: false. -
'self_connections'-boolWhether to allow a post/user to connect to itself. Default: false. -
'sortable'-bool|stringWhether to allow connections to be ordered via drag-and-drop. Can be 'from', 'to', 'any' or false. Default: false. -
'title'-string|arrayThe box's title. Default: 'Connected {$post_type}s' -
'from_labels'-arrayAdditional labels for the admin box (optional) -
'to_labels'-arrayAdditional labels for the admin box (optional) -
'reciprocal'-boolFor indeterminate connections: True means all connections are displayed in a single box. False means 'from' connections are shown in one box and 'to' connections are shown in another box. Default: false. -
'admin_box'-bool|string|arrayWhether and where to show the admin connections box. Default: 'any'. See Admin box display -
'can_create_post'-boolWhether to allow post creation via the connection box. Default: true. -
'admin_column'-bool|string|arrayWhether to show connection columns on post/user list table. Default: false -
'admin_dropdown'-bool|string|arrayWhether to show connection dropdown on post/user list table. Default: false. See Admin dropdown display