Support » Plugin: Posts 2 Posts » WP_Query vs. get_posts for p2p_distribute_connected

  • Resolved jtwg


    I was reading the p2p docs for retrieving all connected posts using the WP_Query object. Normally the way I pull out connected items to a post is via shortcodes that serve as placeholders in the post content to show the connected items.

    Typically I’ve used get_posts in my shortcodes for retrieving the connected posts, but now that I am building more complex shortcodes that not only retrieve posts connected to the current post, but also posts connected to the connected posts I’m concerned about database queries multiplying unnecessarily.

    If I’m reading the docs correctly, it seems that I need the WP_Query object in order to make use of the p2p_distribute_connections functionality. Is that correct? Or will this also work using get_posts?

    Thanks for the awesome plugin!

Viewing 1 replies (of 1 total)
  • Plugin Author scribu


    Just use WP_Query. get_posts() is a wrapper around it anyway.

Viewing 1 replies (of 1 total)
  • The topic ‘WP_Query vs. get_posts for p2p_distribute_connected’ is closed to new replies.