SEV Simple hreflang

Description

SEV Simple hreflang adds a field to pages, posts, and categories where you can enter any number of alternate-language versions (hreflang + URL). The plugin automatically outputs these as <link rel="alternate" hreflang="…"> tags in the <head> of the corresponding view — including a self-referencing link to the page itself, as recommended by Google.

Why no block for the hreflang tags themselves?

hreflang annotations are only evaluated by search engines in the <head> (or via HTTP header or sitemap), not in the visible page content. A block inserted into the content would end up in the <body> and simply be ignored. That’s why this plugin deliberately uses post/term meta for the hreflang data itself, instead of a block.

Language Link block for the Navigation block

For block themes, the plugin also adds a “hreflang Language Link” block that can be inserted inside the Navigation block. Set the target language (e.g. en-US) and the block links to the current page’s hreflang alternate for that language. If the current page has no matching alternate, the menu item is left out of the navigation entirely — not just hidden.

Features

  • Sidebar panel in the block editor for pages and posts.
  • Dedicated form field when adding/editing categories (there’s no block editor there).
  • Also supports the static “Posts page” (Settings > Reading).
  • Automatic self-referencing hreflang link, based on the site’s language.
  • Language Link block for the Navigation block, shown only where a translation exists.
  • No settings, no external calls — just activate it.

Multisite

The plugin is fully multisite-compatible. It can be network-activated (active on every site) or activated per site individually, whichever fits your setup — each site keeps its own hreflang data, since post/term meta is already scoped per site.

Installation

  1. Upload the sev-simple-hreflang folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the “Plugins” menu in WordPress.
  3. When editing a page/post: open the sidebar, expand the “hreflang (alternate language versions)” panel. For categories: the field is directly in the form.

FAQ

Why don’t I see a block for hreflang tags in the editor?

There deliberately isn’t one. hreflang tags must live in <head>, not in the content — a content block would be ignored by search engines.

Can I add a language switcher to my navigation menu?

Yes, if your theme is a block theme. Add the “hreflang Language Link” block inside the Navigation block, set the target hreflang code (e.g. en-US), and it links to the current page’s matching alternate. Pages without a matching alternate simply don’t show that menu item.

Does this work with WPML/Polylang?

The plugin works independently of multilingual plugins and manages hreflang values manually per page/post/category. If WPML or Polylang is active and already outputs hreflang, you may end up with duplicate tags — in that case, please use only one of the two solutions.

Is x-default supported?

Yes — the hreflang field is a free-text field, so x-default can be entered directly.

Does this work on Multisite?

Yes. The plugin can be network-activated or activated per site; each site manages its own hreflang data independently.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“SEV Simple hreflang” is open source software. The following people have contributed to this plugin.

Contributors

“SEV Simple hreflang” has been translated into 2 locales. Thank you to the translators for their contributions.

Translate “SEV Simple hreflang” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.3.0

  • Remove local de_DE translation files from the repository; translations are now maintained on translate.wordpress.org.

1.2.0

  • Fix broken readme short description caused by literal <head> markup being stripped by wp.org.
  • Exclude translated .po/.mo/.json language files from the packaged ZIP; only the .pot source ships, translations are hosted on translate.wordpress.org.
  • Bump the Language Link block to apiVersion 3 for iframe block editor compatibility (WordPress 6.3+).

1.1.0

  • Add “hreflang Language Link” block for the Navigation block (block themes), linking to the current page’s alternate for a chosen language and omitted when no matching alternate exists.

1.0.0

  • Initial release.