Title: Multilingualpress &amp; Posts 2 Posts Plugin
Last modified: April 25, 2017

---

# Multilingualpress & Posts 2 Posts Plugin

 *  Resolved [rike1](https://wordpress.org/support/users/rike1/)
 * (@rike1)
 * [9 years ago](https://wordpress.org/support/topic/multilingualpress-posts-2-posts-plugin/)
 * Hey,
    I’m using the multilingualpress Plugin. Our Website is a little bit complex,
   we have different Post-Types and these Post-Types got different connections among
   each others. For connect the different Post-Types we use the Posts 2 Posts. Both
   Plugins work really well. But now I have a little porblem an d I hope someone
   can help me. When I translate the german Post to the English, I want to get the
   setted connections in the english post too. Can I add the connections in the **
   Mlp_Translatable_Post_Data.php**? Is it possible, that it works like this? Where
   I have to implement the Connections in the MultilingualPress?
 *     ```
       public function save($post_id, WP_Post $post) {
   
       		if ( ! $this->is_valid_save_request( $post ) ) {
       			return;
       		}
   
       		$post_id = $this->get_real_post_id( $post_id );
   
       		$this->save_context = array(
       			'source_blog'    => get_current_blog_id(),
       			'source_post'    => $post,
       			'real_post_type' => $this->get_real_post_type( $post ),
       			'real_post_id'   => $post_id,
       		);
   
       		// Get the post
       		$post_data = get_post( $post_id, ARRAY_A );
       		$post_meta = $this->get_post_meta_to_transfer();
   
       		// Get the post connections
               $post_connection = p2p_get_meta( $post_id, 'type', true);
   
       		/** This filter is documented in inc/advanced-translator/Mlp_Advanced_Translator_Data.php */
       		$post_data = apply_filters( 'mlp_pre_save_post', $post_data, $this->save_context );
       		if ( ! $post_data || ! is_array( $post_data ) ) {
       			return;
       		}
   
       		$file     = $path = '';
       		$fileinfo = array();
   
       		// Check for thumbnail
       		if ( current_theme_supports( 'post-thumbnails' ) ) {
       			$thumb_id = get_post_thumbnail_id( $post_id );
       			if ( 0 < $thumb_id ) {
       				$path     = wp_upload_dir();
       				$file     = get_post_meta( $thumb_id, '_wp_attached_file', true );
       				$fileinfo = pathinfo( $file );
       				include_once( ABSPATH . 'wp-admin/includes/image.php' ); //including the attachment function
       			}
       		}
       		// Create the post array
       		$new_post = array(
       			'post_title'   => $post_data['post_title'],
       			'post_content' => $post_data['post_content'],
       			'post_status'  => 'publish',
       			'post_author'  => $post_data['post_author'],
       			'post_excerpt' => $post_data['post_excerpt'],
       			'post_date'    => $post_data['post_date'],
       			'post_type'    => $post_data['post_type'],
                   'connected_type' => $post_connection ['connected_type'],
                   'connected_items' => $post_connection ['connected_items'],
                   // Create the connection part of the array
                  // 'p2p_id' => $post_connection['post_connection'],
   
       		);
       ```
   
 * I hope someone can help me!
    Thanks in advance!

Viewing 1 replies (of 1 total)

 *  [Thorsten Frommen](https://wordpress.org/support/users/tfrommen/)
 * (@tfrommen)
 * [9 years ago](https://wordpress.org/support/topic/multilingualpress-posts-2-posts-plugin/#post-9092052)
 * I answered this over at GitHub. Please don’t cross post in the future, thanks.

Viewing 1 replies (of 1 total)

The topic ‘Multilingualpress & Posts 2 Posts Plugin’ is closed to new replies.

 * ![](https://ps.w.org/multilingual-press/assets/icon-256x256.png?rev=2188271)
 * [MultilingualPress](https://wordpress.org/plugins/multilingual-press/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/multilingual-press/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/multilingual-press/)
 * [Active Topics](https://wordpress.org/support/plugin/multilingual-press/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/multilingual-press/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/multilingual-press/reviews/)

## Tags

 * [mlp](https://wordpress.org/support/topic-tag/mlp/)
 * [p2p](https://wordpress.org/support/topic-tag/p2p/)

 * 1 reply
 * 2 participants
 * Last reply from: [Thorsten Frommen](https://wordpress.org/support/users/tfrommen/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/multilingualpress-posts-2-posts-plugin/#post-9092052)
 * Status: resolved