[ad_1]
Would you like the post insertion to launch a translation, or would you like a translation to insert a post ? ๐
Thank you for your reply.
Our site is bilingual French/English (WPML).
I use Buddypress for the forums.
I would like a message written in English to be translated into French and vice versa.
For the moment, itโs simply duplicated in the other language. Using the wp_insert_post hook, I can modify the content with wp_update_post.
I just need to translate the content, and the title, before applying wp_update_post.
Iโd like to use a plugin function for this.
I hope Iโve made myself clear!
Sincerely
Emmanuel Liron
Cโest clair ๐
Youโll need to add something like this somewhere :
add_action('wp_insert_post', 'mysite_translate_post', 10, 3);
function mysite_translate_post( $new_post_id, $WP_Post, $update) {
if( $update ) return;
$args = array(
'ID' => $new_post_id,
'target_lang' => 'en_GB',
);
$updated = deepl_translate_post_link( $args );
}- This reply was modified 9 minutes ago by malaiac.
