| 开发者 | hfranz |
|---|---|
| 更新时间 | 2026年9月14日 06:39 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
<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
sev-simple-hreflang folder to the /wp-content/plugins/ directory.There deliberately isn't one. hreflang tags must live in <head>, not in the content — a content block would be ignored by search engines.
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.
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.
Yes — the hreflang field is a free-text field, so x-default can be entered directly.
Yes. The plugin can be network-activated or activated per site; each site manages its own hreflang data independently.
<head> markup being stripped by wp.org.