Skip to content

WordPress plugin

The Lionrapid WordPress plugin translates a WordPress site server-side: it buffers the HTML WordPress renders, replaces the text with translations from your Lionrapid project, fixes the SEO metadata, and sends the translated page to the browser. Search engines see fully translated HTML, no JavaScript is required for the translation itself, and new text on your site is discovered and synced to the platform for translation automatically.

It shares its backend, cache format, and key conventions with the JavaScript SDK, so a WordPress site and an app can live in the same continuous project. What the plugin does for a site’s search visibility, and the plans it comes with, is on the WordPress translation plugin page.

The plugin is Lionrapid Translation in the WordPress plugin directory. It needs WordPress 6.0 or newer and PHP 8.1 or newer.

  1. Install the plugin. In wp-admin, go to Plugins → Add New Plugin, search for Lionrapid, click Install Now on Lionrapid Translation, and activate it. You can also download lionrapid-translation-<version>.zip from the latest release and upload it under Plugins → Add New Plugin → Upload Plugin: it installs as the same plugin, so updates from the directory reach it too.
  2. Open Settings → Lionrapid and click Connect to Lionrapid. Approve the code in your Lionrapid account, then click Confirm on the settings page. Instead of connecting, you can paste the continuous project’s publishable site key (pk_…, see Authentication) and click Save key. Leave the Lionrapid address as it is.
  3. The project’s settings sync to the site: the source and target languages, the namespace, the language switcher and the excluded paths (see the settings reference). Test connection on the settings page confirms the plugin reaches Lionrapid; then visit a page under a language prefix (for example /es/about/).

ZIP files before 1.3.1 installed into wp-content/plugins/lionrapid, which the directory does not update. Install Lionrapid Translation from the directory and activate it: if the old copy is still active, the new one deactivates it and keeps the site key and settings, which the two copies share. Then delete the old copy from Plugins; the Plugins screen and Settings → Lionrapid point it out. From 1.4.2 on, deleting the old copy keeps the shared settings.

For every front-end request the plugin:

  1. Detects the language from the URL path. /about/ serves the default language untouched; /es/about/ serves Spanish. Only languages you enabled are recognized.
  2. Buffers the rendered page. WordPress renders normally — theme, plugins, blocks — and the plugin captures the final HTML via output buffering, so it works with any theme without template changes. Admin pages, AJAX, REST, and cron requests are skipped.
  3. Finds translatable text in the DOM (see the two modes below).
  4. Fetches translations, from its local cache first, then from the platform.
  5. Replaces the text. Every block it handled carries data-lr-block="<key>", translated or not.
  6. Applies SEO handling (see below) and returns the page.

New, never-seen text is shown in the original language on the first request, queued, and synced to the platform in the background — it shows up translated once translators (or MT) have handled it.

The plugin translates all visible text, block by block (paragraphs, headings, list items, table cells and the like), with guardrails:

  • Text inside <script>, <style>, <code>, <pre>, <textarea>, <noscript>, and <svg> is never touched.
  • Elements with translate="no", data-no-translate or the class no-translate are skipped, with everything inside them.
  • Text that is an email address, a URL, a number or a phone number is skipped, as is text shorter than the minimum length set in your project.
  • Excluded paths, set in your project, switch off translation for whole URL sections.

Detected text is keyed by a hash of its content, so the same sentence appearing on ten pages is one string in your project.

An element with a data-i18n attribute uses that named key instead of a hash:

<span data-i18n="welcome">Welcome to our shop</span>
<span data-i18n="checkout:total">Total</span>

A key without a namespace prefix gets the site’s namespace. A named key is stable: it survives copy edits, and translators see it in context.

Translated pages come out SEO-correct without extra plugins:

  • lang attribute — <html lang="es"> is set to the served language.
  • hreflang alternates — a <link rel="alternate" hreflang="…"> tag is injected for every enabled language, plus an x-default pointing at the default-language URL, so search engines index each language variant correctly.
  • Path-based URLs — each language lives under its own path prefix (/es/…, /de/…), which keeps language variants crawlable and shareable as distinct URLs.
  • Meta tags — the meta description and Open Graph tags are translated along with the page body.

The plugin registers blocks for the block editor:

  • Translation block — renders a translation by key, with optional parameters, and outputs the data-i18n markup for you. Authors pick the key; the plugin resolves the translation server-side on every request.
  • Language switcher block — a list of links to the current page in every enabled language, using the path-prefixed URLs.

Blocks are the recommended way to put named keys into content: unlike auto-detected text, a block’s key survives copy edits (editing the text in one language doesn’t orphan the translations).

The plugin caches translations in WordPress options, one row per string (lionrapid_row:{locale}:{namespace}:{key}) and one per namespace (lionrapid_bulk:{locale}:{namespace}), with values stored as { text, styles } content units, the same as the SDK. Lookups go individual key → namespace bulk → server.

Sync runs in the background, after the response is sent:

  • Newly discovered text is batched and pushed to the platform’s batch sync endpoint with your integration key as bearer auth (endpoint detail in the Platform API reference).
  • Once a string is synced its status is pending — the original text is served until a translation exists, then the refreshed cache takes over.
  • The cache is refreshed from the server after each sync round, and before a page is rendered when it is stale.

On the plugin’s settings page, Settings → Lionrapid:

Setting What it controls
Connect to Lionrapid, or site key The connection to your project; the Lionrapid address stays as it is
Translate this site Master switch for the plugin
Tell search engines about your languages The hreflang alternate links
Test connection, Sync now Checks the plugin reaches Lionrapid; pulls the project’s settings now
Clear saved translations, Refresh language URLs Maintenance: refetch the cache; re-create the /xx/ routes

From your Lionrapid project, synced to the site and read-only there:

Setting What it controls
Source and target languages The site’s language and the languages served under path prefixes
Namespace Where the site’s strings live in the project
Language switcher Style, position, flags and names
Excluded paths URL sections that are never translated
Paths behind a login Pages whose text is never collected
Languages not indexed Languages served with noindex
Server-side translation Master switch for translating the page on the server
Minimum text length Shortest text the plugin picks up
  • Nothing is translated — check that you are on a non-default language URL (/es/…), the language is among the project’s target languages, and Test connection on Settings → Lionrapid succeeds.
  • A string stays in the source language — first visits show the original by design; check the continuous project for the synced string and its translation status.
  • Something is translated that shouldn’t be — put data-no-translate (or the class no-translate) on the element, or exclude its path in your project; for a string that needs a stable name, give it a data-i18n key.
  • Verifying output — every block the plugin handled carries data-lr-block="<key>", and the <html lang> attribute reflects the served language, so both are easy to check in the page source.