Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Waqas Bin Hasan 1 year ago.

Author Posts
April 16, 2024 at 8:13 am #15523141

jeanC-6

From code I create a page in the default language:

// Creazione della pagina in italiano
$page_data = array(
'post_title' => 'Pagina di esempio',
'post_content' => 'Questo è il contenuto della pagina di esempio.',
'post_status' => 'publish',
'post_author' => get_current_user_id(), // ID dell'autore della pagina
'post_type' => 'page',
'post_name' => 'pagina-di-esempio' // Slug della pagina
);

// Inserisci la pagina e ottieni l'ID
$page_id = wp_insert_post($page_data);

How do I create the translation of this page into English from code?

April 16, 2024 at 10:03 am #15524008

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the support.

Meanwhile this ticket is attended by one of my colleagues, please note that support for custom coding is out of scope of this forum. However, as a general idea, you'll need to create another post with English content and link it as a translation of the said post.

WPML offers filters and action hooks that can be used in your WordPress theme or plugin to provide correct multilingual support. Browse following resources for more information:

- https://wpml.org/documentation/support/wpml-coding-api/
- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/
- https://wpml.org/faq/how-to-get-current-language-with-wpml/
- https://wpml.org/documentation/support/wpml-tables/

If you need additional custom work, we recommend you contact WPML Contractors at https://wpml.org/contractors/.

Regards.

The topic ‘[Closed] creare da codice la traduzione di una pagina’ is closed to new replies.