Create language-aware home links

On the public frontend, a root home_url() call can become the home address for the active locale. POM Translate adds the locale prefix only when that language is configured to use one.

Expected results

Given a site home of:

https://example.com/

a prefixed Spanish locale can produce:

https://example.com/es/

The base locale remains unprefixed unless its language settings explicitly enable a prefix. A locale configured without a prefix also keeps the normal root address.

Use the WordPress home API

Theme and plugin components should generate a front-page link through WordPress rather than hard-coding / or concatenating a language code. POM Translate filters root home URLs after WordPress has reached the frontend template stage and sends them through the same localized URL builder used elsewhere.

The filter intentionally leaves these cases alone:

  • an empty URL;
  • home_url() calls with a non-root path;
  • REST requests;
  • administration requests that must remain in the base locale;
  • calls made before frontend routing is ready;
  • calls made inside core permalink, term-link, canonical, and trailing-slash filters.

Those guards prevent a home-link convenience from interfering with canonical route generation.

Verify each presentation

  1. Open the public site in the base locale.
  2. Follow the logo, site-title, breadcrumb-home, and explicit Home menu links.
  3. Switch to a prefixed locale and repeat.
  4. Confirm the link points to that locale's root once, without duplicate prefixes.
  5. Repeat for any locale that intentionally has no prefix.

A menu item linked to the native site home may also pass through menu URL localization. If a hand-authored component still points to /, update that component to generate its URL through WordPress instead of trying to repair it with a custom external mapping.

For prefix choices, see Configure language prefixes.