Title: [Plugin: Posts 2 Posts] Problem upgrading from 1.1.5 to 1.1.6
Last modified: August 20, 2016

---

# [Plugin: Posts 2 Posts] Problem upgrading from 1.1.5 to 1.1.6

 *  [jtwg](https://wordpress.org/support/users/jtwg/)
 * (@jtwg)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/)
 * None of the custom connected items show up where they used to.
 * This happens a lot with this plugin. Really makes upgrading a huge roll of the
   dice. The author should probably include some documentation about any settings
   that might need to be changed in the future.
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/page/2/?output_format=md)

 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617582)
 * > None of the custom connected items show up where they used to.
 * Please be more descriptive. What connection type do you have? Where were they
   supposed to show up? etc. etc.
 *  [Dave James Miller](https://wordpress.org/support/users/davejamesmiller/)
 * (@davejamesmiller)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617611)
 * I have the same issue, but first I’m afraid I have to agree with “Really makes
   upgrading a huge roll of the dice” – minor version upgrades in P2P regularly 
   break backwards compatibility. I don’t want to complain too much because it’s
   free and it’s a very useful plugin, but [semantic version numbers](http://semver.org/)
   and more information in the change log would be greatly appreciated!
 * The first error I got after upgrading was this:
 * `Warning: Invalid argument supplied for foreach() in /.../posts-to-posts/core/
   query.php on line 95`
 * (Note: I get this error even when I’m not using P2P in the query at all, so I
   think that’s a separate bug.)
 * Then I added this to the query:
 * `'connected_type' => 'case_studies_to_staff'`
 * That removed the error message, but now I get no results at all, the same as 
   _jtwg_.
 * I also changed `'connected_from' => get_queried_object_id();` to `'connected_items'
   => get_queried_object_id()` as shown on [the wiki](https://github.com/scribu/wp-posts-to-posts/wiki/Basic-usage),
   but it didn’t make a difference.
 * My functions.php contains this:
 *     ```
       add_action('init', 'init_p2p', 100);
       function init_p2p() {
           p2p_register_connection_type(array(
               'name'  => 'case_studies_to_staff',
               'from'  => 'case-studies',
               'to'    => 'staff',
               'title' => 'Staff',
           ));
       }
       ```
   
 * The widget looks like this (I have removed all irrelevant options):
 *     ```
       $query = new WP_Query(array(
           'post_type' => 'staff',
           'connected_type' = 'case_studies_to_staff',
           'connected_items' = get_queried_object_id(),
       ));
       ```
   
 * This is what worked correctly in the previous version:
 *     ```
       $query = new WP_Query(array(
           'post_type' => 'staff',
           'connected_from' = get_queried_object_id(),
       ));
       ```
   
 * If there’s anything else that would help debug it just let me know. For now I’m
   going to downgrade back to 1.1.5.
 * Thanks
    Dave
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617623)
 * Yeah, adding multiple connection type queries in a minor release was a mistake.
 *     ```
       $query = new WP_Query(array(
           'post_type' => 'staff',
           'connected_from' => get_queried_object_id(),
       ));
       ```
   
 * Granted, this used to work, but it was intended only for the migration script,
   which sometimes fails, precisely because queries without a connection type are
   inexact.
 * Let it be known: **Queries without a ‘connected_type’ parameter are no longer
   supported.**
 * This should work:
 *     ```
       $query = new WP_Query(array(
           'connected_type' => 'case_studies_to_staff',
           'connected_items' => get_queried_object_id(),
       ));
       ```
   
 * provided that get_queried_object_id() returns either a case study ID or a staff
   ID.
 *  Thread Starter [jtwg](https://wordpress.org/support/users/jtwg/)
 * (@jtwg)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617741)
 * Thanks for the reply, scribu.
 * Question for you: I have a table full of already established connections – will
   your plugin update those rows to add the connected_type if I provide it in my
   connection registrations? Or will the connections need to be re-created?
 * This is a problem I’ve run into a lot, needing to re-establish already present
   connections to provide missing values in the new fields.
 * Please advise, thanks.
 * P.S. agree with Dave about that I also don’t want to complain too much, for the
   same reasons he cites. I love this plugin, and use it on a great many sites. 
   It’s incredibly useful. Semantic versioning and more explicit changelogs would
   definitely make it even more useful because the broken backwards compatibility
   really causes a lot of problems on production sites.
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617742)
 * You said you were upgrading from 1.1.5 to 1.1.6, so all connections should already
   have the p2p_type column populated.
 * If the connection type has no ‘name’ parameter when it’s defined, the p2p_type
   column will be filled with a generated hash.
 * Here’s more info:
 * [http://wordpress.org/support/topic/plugin-posts-2-posts-all-existing-connection-gone?replies=15#post-2517920](http://wordpress.org/support/topic/plugin-posts-2-posts-all-existing-connection-gone?replies=15#post-2517920)
 *  [psnepsts](https://wordpress.org/support/users/psnepsts/)
 * (@psnepsts)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617770)
 * I have similar woes with the 1.1.6 upgrade. In my case, I have nested loops that
   draw connected information from the $post->ID (as opposed to get_queried_object_id()).
   I have 3 Custom Post Types to to run an event system for a comedy festival: tscf-
   troupes, tscf-shows, and venues. Each show can have multiple troupes attached
   to it, but only one venue. Each troupe can be attached to multiple shows.
 * Here’s what my template’s ‘single’ looks like for a particular “Troupe:”
 * [http://pastebin.com/vVWwYcR4](http://pastebin.com/vVWwYcR4)
 * The first query seeks to get all ‘tscf-shows’ that the current ‘tscf-troupe’ 
   is attached to and display each.
 * The second query is a sub-query that seeks to get the ‘venues’ that is attached
   to each show that is returned in the first query, and output its address.
 * The third query, also a sub-query, seeks to find the name of each ‘tscf-troupe’
   that is featured on each show from the first query, and output a link to that
   troupe’s page. (The current troupe would also output in this list with a link
   to the current page).
 * Now – prior to the 1.1.6 upgrade, these all worked smoothly. Should I downgrade
   to 1.1.5? If so, I’m committing myself to sticking with that version and I’m 
   not sure that’s the best idea.
 * Any ideas here would be very much appreciated.
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617771)
 * That looks like correct usage. Will investigate soon.
 * For the nested loops, you should try using each_connected():
 * [https://github.com/scribu/wp-posts-to-posts/wiki/Looping-The-Loop](https://github.com/scribu/wp-posts-to-posts/wiki/Looping-The-Loop)
 * (added an example for using it multiple times on the same outer query)
 *  [psnepsts](https://wordpress.org/support/users/psnepsts/)
 * (@psnepsts)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617772)
 * In this case, is ‘actors’ the name of the post_type?
 * `p2p_type( 'movies_to_actors' )->each_connected( $my_query, array(), 'actors');`
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617773)
 * No, it’s the key used to store the list of actors on the $post object: `$post-
   >actors`.
 *  [psnepsts](https://wordpress.org/support/users/psnepsts/)
 * (@psnepsts)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617774)
 * Also, I presume that:
    `p2p_list_posts( $post->actors );`
 * simply outputs a list of links to associated posts.
 * In the example I am using above, I used to be able to loop over the results and
   access the post_meta for each to output, for example, a link to a map that is
   generated using a custom field for the venue’s address.
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617775)
 *     ```
       foreach ( $post->actors as $post ) {
         setup_postdata( $post );
   
         print_r( get_post_meta( $post->ID ) );
         ...
       }
   
       wp_reset_postdata();
       ```
   
 * Would you like some fries with that?
 *  [psnepsts](https://wordpress.org/support/users/psnepsts/)
 * (@psnepsts)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617776)
 * Well… no wonder I wasn’t getting my pages as I had thought they should be. All
   of my existing connections have been blown out.
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617777)
 * Define “blown out”.
 *  [psnepsts](https://wordpress.org/support/users/psnepsts/)
 * (@psnepsts)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617778)
 * All connected posts previously entered have been disassociated from one another.
   In my example, an entry for a post_type of ‘tscf-show’ would be connected to 
   a number of ‘tscf-troupes’ entries, and one ‘venues’ entry. This update has resulted
   in the connections I’d made in the past no longer being present.
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/#post-2617779)
 * I don’t think that’s accurate. They should still be in the wp_p2p table.

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/page/2/?output_format=md)

The topic ‘[Plugin: Posts 2 Posts] Problem upgrading from 1.1.5 to 1.1.6’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/posts-to-posts_7a8e9d.svg)
 * [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/posts-to-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/posts-to-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/posts-to-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/posts-to-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/posts-to-posts/reviews/)

 * 18 replies
 * 4 participants
 * Last reply from: [scribu](https://wordpress.org/support/users/scribu/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-problem-upgrading-from-115-to-116/page/2/#post-2617782)
 * Status: not resolved