# Keep Mixed-Direction Names Readable

> Wraps comment author names and post author names in a bidi-isolate element so a Hebrew or Arabic name does not scramble the punctuation around it on a left-to-right page (and vice versa).

- Type: PHP
- Runs: Frontend only
- Category: [Multilingual](https://wpide.com/library/category/multilingual/)
- Tags: rtl, bidi, comments
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/i18n-bidi-isolate-names/

## Code

```php
add_filter( 'get_comment_author', function ( $author ) {
    return is_admin() || '' === $author ? $author : '<bdi>' . $author . '</bdi>';
}, 99 );

add_filter( 'the_author', function ( $author ) {
    return is_admin() || is_feed() || '' === (string) $author ? $author : '<bdi>' . $author . '</bdi>';
}, 99 );
```

## Notes

Uses the HTML <bdi> element, supported by all current browsers.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Keep Mixed-Direction Names Readable" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
