Skip to content

Query vars

scribu edited this page Oct 15, 2011 · 18 revisions

The P2P_Connection_Type class doesn't query the database directly. Instead, it passes custom query vars to WP_Query, which are then handled by the P2P_Query class:

'connected_query' => array(
  'posts' => 'any', post id or array of post ids
  'direction' => 'any', 'from' or 'to'
)

Shortcuts:

'connected' => $posts maps to 'connected_query' => array( 'posts' => $posts, 'direction' => 'any' ) 'connected_to' => $posts maps to 'connected_query' => array( 'posts' => $posts, 'direction' => 'to' ) 'connected_from' => $posts maps to 'connected_query' => array( 'posts' => $posts, 'direction' => 'from' )

  • 'connected_meta': array( $meta_key => $meta_value ) or meta_query syntax
  • 'connected_orderby': $meta_key
  • 'connected_order': 'asc' or 'desc'
  • 'connected_order_num': true or false
Clone this wiki locally