WordPress filter hook
wpml_get_translated_slug
Fired by 10 WordPress plugins, running on 320K+ sites between them.
How to use wpml_get_translated_slug
It's a filter: your callback receives the value and 3 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'wpml_get_translated_slug', function( $slug, $taxonomy, $language, $arg4 ) {
// Change $slug here.
return $slug;
}, 10, 4 );Argument names come from WPML Multilingual & Multicurrency for WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
10 plugins that fire wpml_get_translated_slug
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WPML Multilingual & Multicurrency for WooCommerce100,000+ installs
apply_filters( 'wpml_get_translated_slug', $slug, $taxonomy, $language, WPML_Slug_Translation_Factory::TAX )inc/class-wcml-url-translation.php:743 -
Permalink Manager Lite100,000+ installs
apply_filters( 'wpml_get_translated_slug', $post_type_slug, $post_type, $language_code )includes/integrations/permalink-manager-language-plugins.php:943 -
HUSKY80,000+ installs
apply_filters( 'wpml_get_translated_slug', $f_key, $f_key, null, 'taxonomy' )ext/url_request/classes/url_parser.php:369 -
BetterDocs30,000+ installs
apply_filters( 'wpml_get_translated_slug', $docs_slug, 'docs' )includes/Core/Request.php:882 -
Classified Listing8,000+ installs
apply_filters( 'wpml_get_translated_slug', rtcl()->category, rtcl()->category, $lan_key, 'taxonomy' )app/Controllers/Query.php:247 -
annasta Filters for WooCommerce1,000+ installs
apply_filters( 'wpml_get_translated_slug', $original_slug, $taxonomy, null, 'taxonomy' )code/class-a-w-f.php:1271 -
immonex Kickstart300+ installs
apply_filters( 'wpml_get_translated_slug', $source_slug, $post_type, $lang )includes/class-wpml-compat.php:148 -
Verowa Connect100+ installs
apply_filters( 'wpml_get_translated_slug', $cpt_slug, $str_post_type, $str_language_code )functions/wpml.php:525 -
Custom Permalinks for Custom Post Types100+ installs
apply_filters( 'wpml_get_translated_slug', $post_type_slug, $post->post_type, $post_language_info['language_code'] )custom-permalinks-for-custom-post-types.php:54 -
Rooster LMSFewer than 10 installs
apply_filters( 'wpml_get_translated_slug', $base, PersonsModule::POST_TYPE, $code )includes/Persons/Urls.php:32
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.