Copy the same post in custom post type in different language(WPML)

Question

On my website, I’m using WPML and there are two languages DE & EN. DE is the default language so whenever I’m creating posts from API that runs via cron, that adds posts only in default language DE. Now the same post I want to add with the same name and same custom fields on the en also
E.g Test Post that should also insert in English version as well.

Note: I’m using wp_insert_post here is some code snippet I have used:

$post_args = array('post_type'  => 'book2skicourse', 
            'post_title'    => wp_strip_all_tags( $course->name ),
            'post_content'  => $notes,
            'post_status'   => 'publish');
$post_id = wp_insert_post( $post_args );
update_post_meta($post_id, 'notes', $course->notes);
0
Shadow 2 months 0 Answers 9 views 0

Leave an answer