---
title: How to Translate the Back Button
description: "Translate the WordPress back button label into the visitor's language with the translate shortcode or the lang attribute. Free."
url: "https://wpfactory.com/docs/translate-the-back-button/"
updated: "2026-09-27"
category: How to
---

# How to Translate the Back Button

To show the back button label in the visitor's language, use the built-in translation options in [Back Button Anywhere Widget for WordPress](https://wpfactory.com/item/back-button-widget-wordpress-plugin/). These are free and work with multilingual plugins that set the standard `ICL_LANGUAGE_CODE` constant, such as WPML and Polylang.

### Option 1: the translate shortcode

`[alg_back_button_translate]` outputs different text depending on the active language. It has two forms.

#### Self-closing form

Provide all three attributes: `lang`, `lang_text`, and `not_lang_text`.

```
[alg_back_button_translate lang="FR" lang_text="Retour" not_lang_text="Back"]
```

When the active language is French, this prints "Retour"; otherwise it prints "Back".

#### Enclosing form

Wrap the text between opening and closing tags. Use `lang` to show it only for a language, or `not_lang` to show it for everything except a list.

```
[alg_back_button_translate lang="FR"]Retour[/alg_back_button_translate]
[alg_back_button_translate lang="DE"]Zurück[/alg_back_button_translate]
[alg_back_button_translate not_lang="FR,DE"]Back[/alg_back_button_translate]
```

On a French page only "Retour" renders; on a German page only "Zurück"; on any other language only "Back". You can list several codes, comma-separated.

### Option 2: the lang attribute on the button shortcode

The main `[alg_back_button]` shortcode accepts `lang` and `not_lang_text`. When the active language is not in `lang`, the label is replaced with `not_lang_text`.

```
[alg_back_button lang="FR" label="Retour" not_lang_text="Back"]
```

### Combine the two

Because `[alg_back_button]` runs shortcodes inside its `label`, you can nest the translate shortcode in the label to build a fully localized button:

```
[alg_back_button label='[alg_back_button_translate lang="FR" lang_text="Retour" not_lang_text="Back"]']
```

### Attributes reference

| Attribute | Used in | Effect |
| --- | --- | --- |
| `lang` | both shortcodes | Language code(s) this text applies to. |
| `lang_text` | `[alg_back_button_translate]` | Text shown when the language matches (self-closing form). |
| `not_lang_text` | both shortcodes | Text shown when the language does not match. |
| `not_lang` | `[alg_back_button_translate]` | Language code(s) to exclude (enclosing form). |

### Good to know

- Language codes are matched case-insensitively, so `FR` and `fr` behave the same.
- These options read the active language from `ICL_LANGUAGE_CODE`. If no multilingual plugin sets it, the non-matching text is used.
- The `fa` (Font Awesome) attribute and the `lang` label swap cannot be combined in one `[alg_back_button]`. Use separate shortcodes if you need both an icon and a translated label.

### Get more control

Translation is free. [Back Button Anywhere Widget for WordPress](https://wpfactory.com/item/back-button-widget-wordpress-plugin/) Pro adds menu placement, a floating button, and hide/show rules. [See what Pro unlocks](https://wpfactory.com/item/back-button-widget-wordpress-plugin/).

Related articles

- [How to Add a Font Awesome Icon to the Back Button](https://wpfactory.com/docs/add-font-awesome-icon-to-back-button/)
- [How to Customize the Back Button (Color, Style, Position, Icon)](https://wpfactory.com/docs/how-to-customize-the-back-button-color-style-position-icon/)
- [Getting Started with Back Button Widget](https://wpfactory.com/docs/using-back-button-widget/)
- [How to Add a Floating Back Button](https://wpfactory.com/docs/add-floating-back-button/)
- [How to Add the Back Button to a WordPress Menu](https://wpfactory.com/docs/add-back-button-to-wordpress-menu/)
