WordPress filter hook
wpml_copy_post_to_language
Fired by 3 WordPress plugins, running on 11K+ sites between them.
How to use wpml_copy_post_to_language
It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'wpml_copy_post_to_language', function( $post_id, $target_language, $mark_as_duplicate ) {
// Change $post_id here.
return $post_id;
}, 10, 3 );Argument names come from Sensei LMS's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
3 plugins that fire wpml_copy_post_to_language
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Sensei LMS9,000+ installs
apply_filters( 'wpml_copy_post_to_language', $post_id, $target_language, $mark_as_duplicate )includes/wpml/trait-wpml-api.php:214 -
MultiVendorX2,000+ installs
apply_filters( 'wpml_copy_post_to_language', $product_id, $lang_code, false )modules/WPML/Rest.php:228 -
Islamnashaat Translation ToolkitFewer than 10 installs
apply_filters( 'wpml_copy_post_to_language', $post_id, $target, false )islamnashaat-translation-toolkit.php:599
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.