WordPress.org

Support

Support » Plugins and Hacks » Posts 2 Posts » [Resolved] [Plugin: Posts 2 Posts] Pass query parameters to get_related()

[Resolved] [Plugin: Posts 2 Posts] Pass query parameters to get_related()

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author scribu

    @scribu

    get_related() is implemented using two calls to get_connected():

    public function get_related( $item, $extra_qv = array(), $output = 'raw' ) {
    	$extra_qv['fields'] = 'ids';
    
    	$connected = $this->get_connected( $item, $extra_qv, 'abstract' );
    
    	$additional_qv = array( 'p2p:exclude' => _p2p_normalize( $item ) );
    
    	return $this->flip_direction()->get_connected( $connected->items, $additional_qv, $output );
    }

    As you can see, the extra query vars are passed to the first query, but not to the second, but it’s pretty easy to implement your own version.

    I had noticed this, but I thought there was another way.

    Thanks for your attention!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] [Plugin: Posts 2 Posts] Pass query parameters to get_related()’ is closed to new replies.
Skip to toolbar