plugins - How to import multiple language mutations to polylang?

admin2025-06-07  24

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?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749253252a317637.html

最新回复(0)