I'm import data from a 3rd party system using API.
for each item i import, i create new post in the main Hebrew language and populate it with ACF data. i have also the data in English ready in vars in my script, but i don't know how to create also the English version of the same post.
I'm using a custom post "movies".
here is the part that i check if the post exists
$moviePost = get_page_by_title( $postTitle, OBJECT, 'movies' );
if ( $moviePost == null ) {
$post_id = wp_insert_post( $post );
} else {
// don't create new post
$post_id = $moviePost->ID;
}
and here the part where i update the post data:
update_post_meta( $post_id, '_visibility', 'visible' );
update_post_meta( $post_id, 'lang', $langHeb );
update_post_meta( $post_id, 'category', $category );
update_post_meta( $post_id, 'year', $year );
update_post_meta( $post_id, 'country', $countryHeb );
update_post_meta( $post_id, 'duration', $duration );
update_post_meta( $post_id, 'program', $programHeb );
wp_set_post_terms( $post_id, $tag, 'competition', true);
What is the link to your site?
this is a sample link to an Hebrew film page: hidden link
Welcome to the WPML support forum. I will do my best to help you to resolve the issue.
We have an API called wpml_set_element_language_details to update the language details of a Post or Taxonomy term. Please check the following URL for more details.
I can see some custom solutions from our clients on the following ticket. It may be helpful for you. But please note, we haven't tested it yet because of the customized requirements.
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.