> For the complete documentation index, see [llms.txt](https://developers.weglot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.weglot.com/wordpress/helpers-functions-1/weglot_language_code_replace.md).

# weglot\_language\_code\_replace

Replace Weglot's default language code with a custom one (e.g. `tw` → `zh-HK`). See the dedicated use case for the full example.

```php
add_filter( 'weglot_language_code_replace', 'custom_weglot_language_code_replace' );
function custom_weglot_language_code_replace( $replacements ) {
    $replacements['tw'] = 'zh-HK';
    return $replacements;
}
```
