Gloty Docs

Reference

Developer reference

Extension points, endpoints, and storage. Gloty is GPL-licensed PHP 8.1+ with PSR-4 autoloading under the Gloty\ namespace, so everything below is inspectable in the plugin source.

Filters

Output pipeline

Filter Default Purpose
gloty_capture_output true Whether rendered page HTML is scanned for new translatable text. Return false to disable capture.
gloty_translate_output true Whether stored translations are injected into the page output.
gloty_rewrite_output_links true Whether the links-only rewrite pass runs, which fixes theme-hardcoded absolute URLs that bypass WordPress URL filters.
// Skip HTML capture on a heavy archive template.
add_filter( 'gloty_capture_output', function ( bool $capture ): bool {
    return is_post_type_archive( 'product' ) ? false : $capture;
} );

Dispatch

Filter Default Purpose
gloty_dispatch_batches_per_tick 5 Batches sent per background cron run. Raise to drain a backlog faster; lower on a constrained host.
gloty_manual_dispatch_batches 20 Batches sent by the Translate now button.
// Push harder during an initial backfill.
add_filter( 'gloty_dispatch_batches_per_tick', fn (): int => 15 );

Translation lookup

Filter Signature Purpose
gloty_translation_row_is_stale bool $stale, array $row, string $source_text Force a stored translation to be treated as stale — return true and the source text is served instead.
gloty_template_domain_for_row string $domain, array $row Override the text domain recorded for a captured template string.

Actions

Action Fires when
gloty_purged_post_cache Gloty purged the cached variants of a post. Hook this to purge a custom or CDN cache.
gloty_purged_url_cache Gloty purged a specific URL.
gloty_page_bundle_changed A page's translation bundle changed — new results, an edit, or a deletion.
gloty_translation_marked_stale A translation was flagged stale because its source text changed.
gloty_glossary_changed A glossary term was added, edited, or removed.
gloty_license_status_changed The daily license check returned a different plan, quota, or status.
// Purge a bespoke edge cache whenever Gloty purges a URL.
add_action( 'gloty_purged_url_cache', function ( string $url ): void {
    my_edge_cache_purge( $url );
} );

REST API

All endpoints live under the gloty/v1 namespace. Every administrative route requires the manage_options capability and a valid REST nonce (X-WP-Nonce); responses across the namespace are marked non-cacheable so a CDN cannot serve a stale read after a write.

Endpoint Method Purpose
/status GET Plugin name and version.
/boot GET The full admin bootstrap payload — languages, connection, license, settings, routing.
/dashboard GET Overview statistics.
/issues GET Live health checks.
/activity GET Recent sync events.
/languages GET, POST List and add languages.
/languages/{id} PUT/PATCH, DELETE Update (including activation) or remove a language.
/languages/default POST Set the source language.
/settings/plugin GET / POST Read and write plugin settings.
/settings/routing, /settings/routing/update GET / POST URL structure — subdirectory or parameter.
/settings/seo GET / POST SEO toggles.
/glossary GET, POST List and create glossary terms.
/glossary/{id} PUT/PATCH, DELETE Update or remove a term.
/translations GET Paginated list with search, language, status, and staleness filters.
/translations/{id} PUT/PATCH, DELETE Save a manual translation (marks the row manual) or delete the row.
/translations/{id}/retranslate POST Unlock and re-queue a single row. Clears the stored translation, including a manual one.
/translations/dispatch-selected, /translations/delete-selected POST Bulk re-queue or delete, capped at 500 rows per call.
/scan/start, /scan/step, /scan/pause, /scan/resume, /scan/status GET / POST Content scan control.
/jobs, /jobs/dispatch GET, POST Job queue and manual dispatch.
/jobs/{id}/retry, /jobs/{id}/cancel POST Retry or cancel a single batch.
/license/status, /license/activate, /license/deactivate, /license/provision, /license/checkout, /license/portal GET / POST License and billing operations.
/onboarding/connect, /onboarding/language-packs, /onboarding/complete POST Setup wizard steps.
/maintenance/reset-tracked-strings, /maintenance/cleanup-translations POST Destructive cleanup, deliberately not exposed in the UI — see below.
/webhook/ingest POST Translation delivery from the service. Signature-verified, not capability-gated.

Webhook contract

The translation service delivers results to /wp-json/gloty/v1/webhook/ingest. The request carries an x-gloty-signature header holding an HMAC-SHA256 of the raw body, computed with the per-site webhook secret generated during setup, optionally prefixed with sha256=.

  • Invalid or missing signature → 401.
  • Malformed JSON → 400.
  • Delivery IDs are recorded so a replayed webhook is ignored rather than double-applied.

Do not block this route. Security plugins that block POST requests to the REST API will stop webhook delivery. Gloty falls back to polling, so results still arrive — just several minutes later.

Maintenance endpoints

Two destructive operations are available over REST only, kept out of the admin UI on purpose:

Endpoint Parameters Effect
/maintenance/reset-tracked-strings clear_jobs, include_entity_sources Removes interface/template string tracking and the non-entity translation cache. Entity sources (post and term fields) are kept unless you opt in.
/maintenance/cleanup-translations recent_auto_limit, audit_older_than_days Prunes recent machine translations and old audit events.

These delete data. Anything you clear must be rediscovered and retranslated, which spends quota. Take a database backup first, and prefer the Translations screen's targeted bulk actions where they suffice.

Database tables

All tables use your WordPress table prefix followed by gloty_. The schema version is tracked in the gloty_db_version option and migrated on upgrade.

Table Holds
{prefix}gloty_languages Configured languages, native names, locale mapping, active and default flags.
{prefix}gloty_sources Registered source strings and their entity linkage, keyed by content hash.
{prefix}gloty_translations One row per source string per target language, with status and staleness. A uniqueness constraint prevents duplicate pairs.
{prefix}gloty_sync_jobs Dispatched batches and their lifecycle.
{prefix}gloty_glossary Glossary rules — term, normalised key, behaviour, per-language values, case sensitivity.
{prefix}gloty_audit_events Sync and administrative event log.

Cron events

Hook Schedule Does
gloty_sync_dispatch gloty_every_minute Sends pending batches and records a proof-of-life timestamp used for the cron health check.
gloty_sync_reconcile gloty_every_five Polls for results that never arrived by webhook.
gloty_license_check daily Refreshes plan, quota, and available engines.

The two custom intervals gloty_every_minute and gloty_every_five are registered by the plugin. All three events are unscheduled on deactivation.

Constants

Constant Set by Purpose
GLOTY_SERVICE_URL You, in wp-config.php Overrides the translation service base URL. For staging and self-hosted service deployments; production sites need a default that is already configured.
GLOTY_VERSION Plugin Current plugin version; used for asset cache-busting.
GLOTY_PLUGIN_DIR, GLOTY_PLUGIN_URL, GLOTY_PLUGIN_BASENAME Plugin Filesystem and URL paths.

Options

Option Holds
gloty_settings The Settings screen values — provider, auto-translate, batch size, exclusion selectors, switcher style, position, flags, auto-redirect.
gloty_default_language Source language code.
gloty_url_structure subdirectory or parameter.
gloty_seo_hreflang, gloty_seo_meta, gloty_seo_sitemap, gloty_seo_schema SEO toggles.
gloty_translation_cache Whether stored translations are reused.
gloty_switcher_footer_list Opt-in full-width footer language list, in place of the floating switcher.
gloty_site_key, gloty_webhook_secret, gloty_api_token, gloty_service_url, gloty_remote_site_id Connection credentials. Treat as secrets — never log or expose them.
gloty_license_key License key. Status is cached in a transient for 15 minutes.
gloty_db_version Schema version for migrations.

Front-end integration points

Shortcode
[gloty_lang_switcher style="dropdown|inline|flags"]
Widget
gloty_language_switcher — "Gloty Language Switcher".
Query variable
gloty_lang — the active language for the request.
Exclusion classes
.notranslate and .skip-translation are excluded by default; extend the list in Settings.

Uninstall behaviour

Deleting the plugin runs an uninstaller that removes everything Gloty created:

  • Best-effort license deactivation, freeing the site slot.
  • All gloty_ tables are dropped.
  • All gloty_ options and transients are deleted.

Deactivating, by contrast, only unschedules the cron events and stops serving translations — all data is preserved.

Deleting is irreversible. Every translation you have paid for and every manual correction is removed. Back up the database first if there is any chance you will reinstall.

Last updated 26 July 2026 · Gloty 1.15.2