WordPress action hook
pll_duplicate_term
Fired by 3 WordPress plugins, running on 15K+ sites between them.
“Polylang's own meta copy: it honours `pll_copy_term_metas` and doesn't sync the writes back to the source.”
How to use pll_duplicate_term
It's an action: your callback runs at that point and receives 3 arguments. Nothing needs to be returned.
Add this to your theme's functions.php or a small custom plugin:
add_action( 'pll_duplicate_term', function( $source_id, $term_id, $term_language ) {
// Your code runs here.
}, 10, 3 );Argument names come from Sugar Calendar's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
3 plugins that fire pll_duplicate_term
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Sugar Calendar10,000+ installs
do_action( 'pll_duplicate_term', $source_id, $term_id, pll_get_term_language( $term_id ) )src/Integrations/Polylang/PolylangTerms.php:118 -
AutoPoly5,000+ installs
do_action( 'pll_duplicate_term', $term->term_id, $tr_term_id, $lang )includes/bulk-translation/class-atfp-sync-post.php:238 -
TranslateSenseFewer than 10 installs
do_action( 'pll_duplicate_term', $source_term_id, $new_term_id, $target_lang )includes/integrations/polylang/class-polylang-synchronizer.php:666
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.