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 http://www.assopogo.net 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 2 years, 7 months ago by
malaiac.
Thank you.
That’s pretty much what I wrote. But I got an error message: Call to undefined function deepl_translate_post_link()