Weglot
These abilities register when Weglot is detected on the site and a Pro licence is active. If either is missing the module stays absent rather than failing at call time.
At a glance
Weglot registers 19 abilities: 7 that only read, 6 that write, and 6 marked destructive. That split is the practical answer to how much of this module can run unattended. Reads cost nothing and are safe to repeat, so discovery is the part to be generous with; the writes are where review belongs, and the destructive calls stop for an explicit confirmation every single time regardless of which profile is active.
What this module is for
Manage Weglot languages, excluded URLs, translated URLs, switcher settings, cache state, cloud synchronization, and core configuration.
Before you rely on it: Treat API keys as secrets and validate translated routes, canonicals, and hreflang behavior after changes.
Typical workflows
- Audit language and URL configuration before launching a locale
- Review exclusions before a translation crawl
- Refresh cloud state and then verify the local cache
The Weglot integration page covers the same module from the workflow side, with the capability map and the questions worth asking before a first write.
Availability on your site
The Weglot module needs three things at once: WPPilot Free as the MCP foundation, an active Pro licence, and the companion plugin detected on the site. Miss any one and the module does not register, which is deliberate: an ability that appears in the tool list but fails at call time is worse than an ability that was never offered. What the connected agent can actually call is then narrowed twice more: by the safety profile active on the site, and by the WordPress capabilities of the user behind the credential. A read that succeeds for an administrator can be absent entirely for an editor.
Every write these abilities perform is recorded in the change ledger, and destructive calls can be routed through the approval queue so a person signs off before anything is applied. A successful tool result means the operation returned, not that the front end, the cache, and every dependent template are correct: that still needs a look.
Reads
Available in every safety profile, including Read Only. Inspection costs nothing and is not rate limited.
| Ability | What it does |
|---|---|
wppilot/weglot-check-setupCheck Weglot Setup | Reports the Weglot Translate environment: whether Weglot is active, its version, whether the API key is configured (masked output), the cloud project name and plan, language limits, the source language and the destination-language codes, and whether the plan includes translated URL slugs. Call this first before any other Weglot ability. |
wppilot/weglot-get-settingsGet Weglot Settings | Returns the Weglot settings actually in force, scoped to a section: "languages" (source + destination + auto-switch), "button" (language-switcher style: dropdown, flags, name visibility, flag type), "advanced" (translate-search, translate-amp, translate-email, custom CSS, and which languages are kept private), or "all" (combined). Resolved the way Weglot itself resolves its configuration, so cloud-managed values (languages, exclusions, engine) are included even on an install where the admin only pasted the API key. API keys are never returned. Use weglot-get-status for project/plan/quota data. |
wppilot/weglot-get-statusGet Weglot Cloud Status | Queries the Weglot Cloud /projects/owner endpoint with the configured API key and reports the live project status: project name, plan id and label, the destination-language limit, and word usage against the plan quota. The organization and project slugs come from the project settings, which are resolved locally. Error contract: weglot_no_api_key when no key is set, weglot_cloud_key_invalid when the cloud rejects the key (rotate it, do not retry), weglot_cloud_unreachable for a transient network or upstream failure (retry). |
wppilot/weglot-get-translation-cache-stateGet Weglot Translation Cache State | Reports the state of the Weglot local CDN cache transients (weglot_cache_cdn for the merged options snapshot, weglot_slugs_cache for translated URL slugs) Useful for debugging stale-local vs cloud-truth issues: tells the agent whether a cache entry exists, when it was last set (best-effort — WP transients do not expose creation time, so we report whether the row is present in wp_options and the timeout if available), and the default TTL Weglot configures. |
wppilot/weglot-list-exclude-urlsList Weglot URL Exclusions | Returns the URL-exclusion rules persisted in the local Weglot v3 cache: each rule has a match pattern, a type (one of Weglot's nine match modes: START_WITH, CONTAIN, IS_EXACTLY, MATCH_REGEX, their negations, …), and the optional list of language codes it applies to. Rules with an empty language list apply to every destination language. Output is compact: progressive disclosure clamps limit to a sane default; use weglot-get-settings + section="all" for the full options blob. |
wppilot/weglot-list-languagesList Weglot Supported Languages | Returns the full catalog of languages Weglot supports (110+), each with its ISO code, English name, native name, and RTL flag. Use this catalog to look up the code expected by weglot-add-destination-language and weglot-set-original-language. The query input filters by code prefix or name substring; limit clamps the response size for progressive disclosure. |
wppilot/weglot-list-translated-urlsList Weglot Translated URL Slugs | Flattens the Weglot custom_urls v3 cluster (per-language slug overrides) into a list of {language, from_slug, to_slug} entries. The optional language input filters by ISO code. Output is compact and limit-clamped for progressive disclosure; use weglot-get-settings for raw cluster shapes. |
Writes
Gated by the active profile and your WordPress capabilities. Rate limited to 120 per minute per credential.
| Ability | What it does |
|---|---|
wppilot/weglot-add-destination-languageAdd Weglot Destination Language | Adds an ISO language code to the Weglot destination-language list (translations Weglot generates TO). The code must exist in the SDK catalog, must NOT equal the source language, and must NOT already be configured. The optional custom_name overrides the language switcher display name. enabled (default true) is the only visibility switch Weglot has: set it to false to make the language PRIVATE — served to logged-in admins as a preview, hidden from visitors — which is what the Weglot dashboard calls a private language. |
wppilot/weglot-add-exclude-urlAdd Weglot URL Exclusion | Appends a URL-exclusion rule to the Weglot excluded_paths v3 option. value is the path or regex Weglot matches against the requested URL. type is one of Weglot's nine match modes (START_WITH, NOT_START_WITH, END_WITH, NOT_END_WITH, CONTAIN, NOT_CONTAIN, IS_EXACTLY, NOT_IS_EXACTLY, MATCH_REGEX) or an alias — "regex"=MATCH_REGEX (write the pattern itself, e.g. "^/en(/|$)"; if you wrap it in /…/ the delimiters are stripped before persisting, because Weglot adds its own and would otherwise treat yours as literal characters, leaving a rule that matches nothing), "path"=section shortcut that compiles to a MATCH_REGEX matching the path, its root and everything under it ("/en" excludes /en and /en/* but NOT /enterprise; the response echoes the compiled rule). Omit it and a value with no slashes is CONTAIN (Weglot's own default); a slash-wrapped value with NO type is refused, because both readings of it are broken — pass "regex" or "CONTAIN" to say which you meant. languages is an optional ISO-code list — when empty the rule applies to every destination language. Duplicates (same type + value + languages) are rejected with weglot_invalid_input — but an inert legacy string-form entry never counts as a duplicate, so it cannot block a working rule. Returns the new total and the index assigned to the rule (matches the index exposed by weglot-list-exclude-urls). |
wppilot/weglot-add-translated-urlAdd Weglot Translated URL Slug | Sets a translated URL slug for a destination language under the Weglot custom_urls cluster (e.g. "/about-us" → "/qui-sommes-nous" for fr). The destination language must already be configured (use weglot-add-destination-language first). Replaces any pre-existing slug for the same source page and returns previous_to_slug for rollback. IMPORTANT and different from every other write here: this pair takes effect on THIS site immediately, and it can NOT be published to the Weglot Cloud. Translated slugs are not part of the project settings — Weglot keeps them on a separate resource (/translations/slugs), which weglot-push-options-to-cloud does not carry. Because the settings payload has no custom_urls, the merge Weglot performs takes the value from the local store, so the site serves it right away. To have the slug on the Weglot project itself (for other installs, or to see it on the dashboard) edit it at dashboard.weglot.com — but only if the plan allows it: when weglot-check-setup reports supports_slugs=false the slug resource answers 403 and the project cannot hold slugs at all, so the pair stays local and there is nothing to do on the dashboard either. |
wppilot/weglot-clear-translation-cacheClear Weglot Translation Cache | Deletes the Weglot local CDN cache transients: weglot_cache_cdn (the merged options snapshot, default 300s TTL) and weglot_slugs_cache (translated URL slug cache). Also busts the per-request user-info cache used by check-setup and get-status. The next page load (or ability invocation that touches the cloud) re-fetches fresh data. Use this when local data appears stale after upstream cloud edits or after a settings push. |
wppilot/weglot-edit-button-settingsEdit Weglot Button (Language Switcher) Settings | Partial-update for the language switcher button stored under custom_settings.button_style: only the fields included in the input are touched, everything else is preserved. Use weglot-get-settings (section=button) first to read the current shape. Booleans: full_name (long vs ISO code label), with_name (show label), is_dropdown (dropdown vs flat list), with_flags (show country flags). flag_type accepts the four styles Weglot defines: "rectangle_mat", "shiny", "circle", "square" (see Helper_Flag_Type). The numeric aliases Weglot maps internally (0-3) are NOT accepted here — the schema enum rejects them. custom_css overrides the bundled switcher CSS. |
wppilot/weglot-set-api-keySet Weglot API Key | Sets (or rotates) the Weglot API credentials. The required public_key (short "wg_..." token) is ALWAYS validated against /projects/owner before being persisted; if the cloud rejects it (weglot_cloud_key_invalid) or is unreachable (weglot_cloud_unreachable), nothing is saved and the current key is preserved. The optional private_key is validated separately when supplied and reports weglot_private_key_invalid on failure. Both credentials carry the same "wg_" prefix on current projects — tell them apart by role, not by prefix: the public one is what the settings page shows as the site key, the private one is the longer token the dashboard issues for API writes. Required for cloud writes (glossary, custom URL slugs); omit the field to keep the current private key, or pass an empty string to CLEAR it. Returns the project name and plan reported by the richer probe on success. |
Destructive
Marked destructive in the source, so each call needs an explicit confirmation flag, every time.
| Ability | What it does |
|---|---|
wppilot/weglot-delete-destination-languageDelete Weglot Destination Language | Removes a destination language from the Weglot configuration. The local-side translations cache is dropped immediately; cloud-side translations stay in the Weglot project until the language is re-added or the project is reset. |
wppilot/weglot-delete-exclude-urlDelete Weglot URL Exclusion | Removes a URL-exclusion rule by its index (the position reported by weglot-list-exclude-urls). Indexes are re-numbered after each delete — fetch the list again before subsequent deletes in the same batch. Returns weglot_unknown_index when the index is out of range. After delete the remaining rules are stored contiguously (re-indexed). |
wppilot/weglot-delete-translated-urlDelete Weglot Translated URL Slug | Removes a translated URL slug entry from the Weglot custom_urls cluster, identified by language + from_slug. Returns weglot_unknown_slug when no entry matches. If removing the entry leaves an empty per-language map the language key is dropped to keep the persisted blob tidy. IMPORTANT: the deletion takes effect on THIS site immediately and can NOT be published to the Weglot Cloud — slugs live on a separate resource (/translations/slugs) that the settings push does not carry. If the slug also exists on the Weglot project, remove it at dashboard.weglot.com — possible only on a plan with the slug feature: when weglot-check-setup reports supports_slugs=false the project cannot hold slugs at all, so there is nothing to remove there. |
wppilot/weglot-push-options-to-cloudPush Weglot Options to Cloud | Publishes the pending local Weglot edits (languages, exclude rules, custom URLs, button style) to the Weglot Cloud so they take effect for visitors. This is the missing piece for the write abilities: set-original-language, add/delete-destination-language, add/delete-exclude-url, add/delete-translated-url and edit-button-settings all persist LOCALLY and have no effect until this ability runs. Safe by construction: the endpoint merges server-side, and the ability sends only the keys the write abilities actually changed — settings edited on dashboard.weglot.com that no ability touched are untouched. NOTE: translated URL slugs are NOT publishable here; Weglot keeps them on a separate resource, so add/delete-translated-url never appear among the published keys. Requires the private API key (the cloud rejects /projects/settings calls with only the short public key). Returns which keys were overlaid, plus the cloud answer, and clears the local weglot_cache_cdn transient so the next page load re-fetches. |
wppilot/weglot-refresh-from-cloudRefresh Weglot Options from Cloud | Forces a fresh fetch of the Weglot project settings from the cloud: clears the local weglot_cache_cdn and weglot_slugs_cache transients, calls /projects/settings, and rehydrates the local v3 options blob with the cloud response (merged on top of locally-persisted defaults the cloud does not return). Use this when the admin has edited slugs / languages / exclusions on dashboard.weglot.com and you want the local cache to reflect cloud truth before the next page-load auto-refresh. |
wppilot/weglot-set-original-languageSet Weglot Original (Source) Language | Sets the source language Weglot translates FROM (stored as language_from in the v3 options). DESTRUCTIVE on a configured project: Weglot Cloud invalidates every existing translation when the source language changes, so the agent should confirm with the user before invoking this on a non-empty project. The language code must exist in the bundled SDK catalog (use weglot-list-languages to validate); a destination language matching the new source is automatically removed to keep the configuration consistent. |