Improved UI

When you need to create connections, there’s now a link that reveals the connection candidates. This saves vertical space when you’re doing something else in the post editing screen.

When you found the item you want to connect to, you can now click anywhere in the row, instead of just on the ‘+’ icon. This makes it both easier to target and less confusing. After the connection is created, you can click on the connected post’s title to edit it, as before.

Revamped connection querying

The SQL generated for querying connections is now more precise, so that trashed and auto-draft posts are ignored by default.

Also, you can now filter both ends of the connection. For example, you can find all pages connected to any posts in the ‘Tutorials’ category:

$pages = new WP_Query( array(
  'post_type' => 'page',
  'connected_type' => 'pages_to_posts',
  'connected_to' => 'any',
  'connected_query' => array(
    'category_name' => 'tutorials',
  'nopaging' => true
) );

The arguments in the ‘connected_query’ array are used to restrict the other end of the connection. All normal arguments for WP_Query – and for WP_User_Query, respectively – are supported.

New Hooks

  • ‘p2p_init’ – use it instead of ‘init’ to register connection types
  • ‘p2p_created_connection’ – fired after a connection is created
  • ‘p2p_delete_connections’ – fired before connections are deleted

Squashed Bugs

As with every release, there are numerous little things that get fixed along the way, which can be seen here.