polylang-language-api

polylang-language-api is a skill for Codex from Lonsdale201/wp-agent-skills. It costs 136 tokens per session (2,048 once invoked), scanned A, original, MIT.

A guide to using Polylang's public WordPress functions to detect, list, switch, and route by language. It explains how language context works on the frontend, in the admin area, REST requests, and command-line tasks.

In plain words
What is it for?
Use it to find the current or default language, build language-aware URLs and switchers, list languages, or register translated post types and taxonomies.
Why use it?
It prevents code from reading language values in unreliable ways or assuming a language is always available. Proper checks help avoid wrong-language URLs and output when Polylang is inactive or no language is selected.

Skill for Codex

Written for Codex: agents/openai.yaml present.

Good fit Use it to find the current or default language, build language-aware URLs and switchers, list languages, or register translated post types and taxonomies.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lonsdale201/wp-agent-skills/polylang-language-api
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Lonsdale201/wp-agent-skills --skill polylang-language-api
Clone the repo
git clone --depth 1 https://github.com/Lonsdale201/wp-agent-skills

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for polylang-language-api

README.md
[![agentmods](https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/polylang-language-api/github.svg)](https://agentmods.dev/skills/lonsdale201/wp-agent-skills/polylang-language-api)
Your own site
<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/polylang-language-api"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/polylang-language-api/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for polylang-language-api

Your own site · 80×15
<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/polylang-language-api"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/polylang-language-api.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 136 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,048 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Excessive Agency · line 176
    Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
    Fix: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00136 $0.02048
Opus 5 $0.00068 $0.01024
Sonnet 5 $0.00027 $0.00410
Haiku 4.5 $0.00014 $0.00205

Measured 9d ago against content hash 2785c162303a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

polylang-language-api scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

polylang/polylang-language-api/SKILL.md · 210 lines

How it starts

The opening of the file, as written. The whole thing — 210 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Polylang Language API

Use this skill when plugin or classic theme code needs to detect, list, switch, or route by Polylang languages.

Polylang's public API lives in wp-content/plugins/polylang/src/api.php. Prefer those functions over PLL()->... internals. The PLL() accessor exists, but the source itself says API functions are preferred because internals may change.

Load and guard

Polylang may be inactive, may not have languages yet, or may be running in admin/REST/CLI without a current language. Always guard public API use:

if ( ! function_exists( 'pll_current_language' ) ) {
    return;
}

$lang = pll_current_language();
if ( ! $lang ) {
    $lang = pll_default_language();
}

if ( ! $lang ) {
    return;
}

Do not read $_GET['lang'] directly as your language model. Let Polylang define the current language, then read it through pll_current_language().

Current and default language

pll_current_language( $field = 'slug' ) returns the current language on frontend, the admin language filter in admin, and false if no current language exists. Useful fields include:

$slug   = pll_current_language();          // e.g. "en"
$locale = pll_current_language( 'locale' ); // e.g. "en_US"
$name   = pll_current_language( 'name' );
$lang   = pll_current_language( \OBJECT ); // PLL_Language object.

pll_default_language( $field = 'slug' ) has the same field behavior and returns false if no default language exists yet.

Since Polylang 3.4, composite language term properties are accepted:

$term_taxonomy_id = pll_current_language( 'language:term_taxonomy_id' );
$term_language_tt = pll_default_language( 'term_language:term_taxonomy_id' );

Use composite fields only when you need SQL joins or taxonomy term IDs. For most code, use slugs.

List languages

Use pll_languages_list() for language lists:

$slugs = pll_languages_list();

$locales = pll_languages_list( array(
    'fields' => 'locale',
) );

$active_slugs = pll_languages_list( array(
    'fields'     => 'slug',
    'hide_empty' => true,
) );

Read the full file on GitHub · 210 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 210 lines · 136 tokens per session scan A 2785c162303a

Subscribe to this mod's changes

polylang-language-api is a skill published in the GitHub repository Lonsdale201/wp-agent-skills (22 stars, last pushed 2d ago), licensed MIT. It adds 136 tokens to every session and 2,048 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

humanizar-texto-es

Elimina patrones de escritura típicos de IA en textos en español de España para que suenen naturales y humanos. Aplica esta skill siempre que generes, edites o revises textos en español: artículos, guías, tutoriales, emails, copy comercial, publicaciones en redes sociales, documentación, informes o cualquier prosa.…

fernandotellado/ai-skills · 119 tokens

chinese-documentation

A Chinese technical-documentation style guide covering spacing, punctuation, numbers, terminology, and links when Chinese and English appear together.

jnMetaCode/superpowers-zh · 62 tokens

json-ui

CRITICAL: Use for json-ui component rendering and development. Triggers on: json-ui, json render, component catalog, report render, HTML report, I18nString, i18n, bilingual, language switch, dual language, PaperHeader, AuthorList, Abstract, MetricsGrid, Section, Highlight, Zod schema, catalog.ts, cli.ts…

actionbook/actionbook · 118 tokens

comet-bilingual-docs

A workflow for keeping Comet documentation in Chinese and English aligned across READMEs, skills, release notes, and website pages. It preserves confirmed wording, repository structure, examples, commands, links, and configuration names.

rpamis/comet · 70 tokens

dubbing

Dub audio and video into other languages using the ElevenLabs Dubbing API (dubbingv2), preserving the original speakers' voices. Use when translating videos, podcasts, or recordings into other languages, localizing media content, reviewing or correcting dubbing transcripts and translations, or regenerating a dub after…

elevenlabs/skills · 65 tokens

iflytek-text-proofread

A tool that checks Chinese writing through iFlytek’s official document-proofreading service. It looks for spelling, punctuation, wording, factual, terminology, and sensitive-content problems.

iflytek/iFly-Skills · 88 tokens