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:

functions.php
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.

  1. WPML Multilingual & Multicurrency for WooCommerce icon 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
  2. Permalink Manager Lite icon 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
  3. HUSKY icon HUSKY80,000+ installs apply_filters( 'wpml_get_translated_slug', $f_key, $f_key, null, 'taxonomy' ) ext/url_request/classes/url_parser.php:369
  4. BetterDocs icon BetterDocs30,000+ installs apply_filters( 'wpml_get_translated_slug', $docs_slug, 'docs' ) includes/Core/Request.php:882
  5. Classified Listing icon Classified Listing8,000+ installs apply_filters( 'wpml_get_translated_slug', rtcl()->category, rtcl()->category, $lan_key, 'taxonomy' ) app/Controllers/Query.php:247
  6. annasta Filters for WooCommerce icon annasta Filters for WooCommerce1,000+ installs apply_filters( 'wpml_get_translated_slug', $original_slug, $taxonomy, null, 'taxonomy' ) code/class-a-w-f.php:1271
  7. immonex Kickstart icon immonex Kickstart300+ installs apply_filters( 'wpml_get_translated_slug', $source_slug, $post_type, $lang ) includes/class-wpml-compat.php:148
  8. Verowa Connect icon Verowa Connect100+ installs apply_filters( 'wpml_get_translated_slug', $cpt_slug, $str_post_type, $str_language_code ) functions/wpml.php:525
  9. Custom Permalinks for Custom Post Types icon 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
  10. Rooster LMS icon 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.