WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
[resolved] All connections disappeared after updating 1.0.1 to 1.3 (3 posts)

  1. Nicholas
    Member
    Posted 2 years ago #

    Hi,

    I have reverted my plugin to version my old 1.0.1 after updating to 1.3 because all of my connections disappeared during the update.

    Are there known issues I need to address in my code before making the update to 1.3?

    I realise I am several versions behind here. Apologies for that.
    I would like to update correctly without losing my existing connections, which are many.

    I noticed you said in your notes on v1.2 that WP_Query no longer works. I am not sure, but do I need to change my code below?

    This is my code in functions.php:

    /* Activating Post to Page/Albums to Songs relationship via Posts2Posts plugin. Source: https://github.com/scribu/wp-posts-to-posts/wiki/Basic-usage */
    
    function ncp_lr_connection_types(){
    	if ( !function_exists( 'p2p_register_connection_type' ) )
    		return;
    
    	p2p_register_connection_type( array(
    		'id' => 'posts_pages',
    		'from' => 'album',
    		'to' => 'song',
    		'sortable' => 'order'
    	) );
    }

    Code on display page:

    $connected = p2p_type( 'posts_pages' )->get_connected( get_queried_object_id() );
    
    											// Display connected songs
    											echo '<ul>';
    
    											while ( $connected->have_posts() ) : $connected->the_post();

    Thank you.

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. scribu
    Member
    Plugin Author

    Posted 2 years ago #

    Your code looks fine. Did you run the connection upgrade procedure after updating the plugin?

    See WP Admin -> Tools -> Connection Types.

    Also see http://wordpress.org/support/topic/plugin-posts-2-posts-all-existing-connection-gone

    I noticed you said in your notes on v1.2 that WP_Query no longer works.

    That's not what I said. WP_Query works fine, as long as you pass the 'connected_type' parameter.

  3. Nicholas
    Member
    Posted 2 years ago #

    Hi Scribu,

    Thank you for the quick response.

    I did not run the connection upgrade procedure. But I have now done that and everything seems to be working correctly on v1.3.

    My error regarding WP_Query. Noted.

    Thank you very much for your help and plugin!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic