| 开发者 |
nakedcatplugins
webdados |
|---|---|
| 更新时间 | 2026年3月9日 20:13 |
| PHP版本: | 7.2 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv3 |
| 版权网址: | 版权信息 |
lang and dir attributes for that specific page directly from the Document Settings sidebar, without needing to wrap everything in a container block.
This plugin is heavily inspired by the Jb Audras plugin (including this readme file). The development started at WordCamp Europe 2025 Contributor Day, by Marco Almeida from Naked Cat Plugins / Webdados, and the help from Ryan Welcher on the code side and Amber Hinds on the accessibility compliance side.
For more context: this plugin helps you to make your website compliant with the Web Content Accessibility Guidelines (WCAG) success criteria:
lang and dir attributes only on a container block or page if the content is written in a language different from the one set globally on your website.
As per Web Content Accessibility Guidelines:
This enables user agents and assistive technologies to present content according to the presentation and pronunciation rules of that language. This applies to graphical browsers, screen readers, braille displays, and other voice browsers.
Both assistive technologies and conventional user agents can render text more accurately if the language of each passage of text is identified. Screen readers can use the language’s pronunciation rules. Visual browsers can display characters and scripts appropriately.
This is especially important when switching between languages that read from left to right and languages that read from right to left, or when text is rendered in a language that uses a different alphabet. Users with disabilities who know all the languages used in the Web page will be better able to understand the content when each passage is rendered appropriately.
That’s not just good for accessibility. It’s also great for SEO. Search engines like Google can better understand your content when languages are clearly defined. That means improved indexing and potentially better rankings.
Banner photo by Hannah Wright.
Use the Page Language setting (in the Document Settings sidebar) when the entire page or post is written in a different language than the website default. This overrides the lang attribute on the HTML element itself, which corresponds to WCAG 3.1.1 (Language of Page).
In this case, we also recommend creating a dedicated template in the Site Editor (Appearance → Editor → Templates) where shared template parts — such as the header and footer — are also in that same language.
Use the Block Language setting (in the block’s sidebar panel) when only a specific section within a page is in a different language, while the rest of the page remains in the site’s default language. This corresponds to WCAG 3.1.2 (Language of Parts).
The idea is to keep it simple and help content and website editors set different language sections, with as many child-blocks as they want, instead of setting it block by block.
Yes. Use the nakedcatplugins_lang_attr_highlight_color PHP filter and return the color you want.
Here’s a Gist example.
If your are working on a WordCamp website, or you don’t want to mess around with PHP, you can also add custom CSS to change the color, overriding our --nakedcatplugins-lang-attr-highlight-color variable.
Here’s a Gist example.
You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team helps validate, triage, and handle any security vulnerabilities. Report a security vulnerability.
lang and dir attributes for a specific page or post, independently of the website’s default languagenakedcatplugins_lang_attr_highlight_color filter