admin管理员组

文章数量:1130349

I have set of posts that i want to import to wp and they alel have 3 lang mutations. I used

      foreach($pole as $key => $objekt){

    $postid = wp_insert_post(array('post_type' => 'etapa','post_title'=>$key,'post_status' => 'publish'));
    $postidDE = wp_insert_post(array('post_type' => 'etapa','post_title'=>$key,'post_status' => 'publish'));
    $postidEN = wp_insert_post(array('post_type' => 'etapa','post_title'=>$key,'post_status' => 'publish'));

    PLL()->model->post->set_language($postid, 'cs');
    PLL()->model->post->set_language($postidEN, 'en');
    PLL()->model->post->set_language($postidDE, 'de');

    PLL()->model->post->save_translations( $postid, array('en' => $postidEN));
    PLL()->model->post->save_translations( $postid, array('de' => $postidDE));

  }

but only 2 mutations imports and are connected, the third one is imported but isn't connected to their counterparts. Anyone know what is wrong?

I have set of posts that i want to import to wp and they alel have 3 lang mutations. I used

      foreach($pole as $key => $objekt){

    $postid = wp_insert_post(array('post_type' => 'etapa','post_title'=>$key,'post_status' => 'publish'));
    $postidDE = wp_insert_post(array('post_type' => 'etapa','post_title'=>$key,'post_status' => 'publish'));
    $postidEN = wp_insert_post(array('post_type' => 'etapa','post_title'=>$key,'post_status' => 'publish'));

    PLL()->model->post->set_language($postid, 'cs');
    PLL()->model->post->set_language($postidEN, 'en');
    PLL()->model->post->set_language($postidDE, 'de');

    PLL()->model->post->save_translations( $postid, array('en' => $postidEN));
    PLL()->model->post->save_translations( $postid, array('de' => $postidDE));

  }

but only 2 mutations imports and are connected, the third one is imported but isn't connected to their counterparts. Anyone know what is wrong?

本文标签: pluginsHow to import multiple language mutations to polylang