Copy Term Meta to Polylang Category Translations
Copies chosen term meta, such as a category color, icon or display order, to the translations of categories and tags when they are created or updated.
Opens WPIDE on
Code
$wpide_keys = array( 'color', 'icon', 'order' ); // Term meta keys to copy.
add_filter( 'pll_copy_term_metas', function ( $metas ) use ( $wpide_keys ) {
return array_values( array_unique( array_merge( (array) $metas, $wpide_keys ) ) );
} );
Notes
Add your term meta keys to $wpide_keys.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.