Support » Plugin: Posts 2 Posts » Double entries with multiple connections

  • First of all: thanks for this great plugin!

    I’m having an issue using the method as described on the Wiki page (

    I have a post-type ‘adviseur’, that is connected to pages. I use a custom template for the Posts2Posts widget (p2p-ul-adviseur_to_page.php). In the widget I want to show the connected adviseur, with some meta data, so I’m using this query & code:

    // Get connected adviseurs
    $connected = new WP_Query( array(
            'connected_type' => 'adviseur_to_page',
            'connected_items' => get_queried_object(),
            'nopaging' => true,
        ) );
     // Display connected adviseurs
        <div class="adviseurs-block">
        if( $connected->have_posts() ) { ?>
        <h4>Uw adviseur(s):</h4>
        while ( $connected->have_posts() ) : $connected->the_post(); ?>
            <div class="adviseur">
            <h5><?php the_title(); ?></h5>
                <?php lwd_do_adviseur_archive_content() ?>
            </div><!-- end .adviseur -->
        wp_reset_postdata(); // set $post back to original post
    </div><!-- end .adviseurs-block -->

    The function lwd_do_adviseur_archive_content shows some metafield values from the adviseur post type.

    All works well, except when I connect more then one adviseur to a page: then it shows all connected adviseurs twice. If I use the query in a page template it doesn’t show this behavior…What am I doing wrong?

    Thanks in advance!

  • The topic ‘Double entries with multiple connections’ is closed to new replies.