Skip to content

Deploying WPML on a production WordPress site

WPML is the heaviest multilingual stack you can put on WordPress. Deploy it on a live site without the string table eating your database and the language switcher tanking TTFB.

You inherit a 12,000-post WordPress site. Sales agreed last week to launch a French and Spanish version “before end of quarter”. You install WPML on a staging copy, click through the setup wizard, translate three pages to prove the plumbing works, and the admin starts taking eight seconds to load any list view. Then you look at the wp_icl_string_translations table and find it already has 480,000 rows after one afternoon of clicking. WPML works, but it instruments WordPress so aggressively that on a content-heavy site it will rewrite how you think about caching, query budgets, and what “saving a post” actually costs.

What’s happening

WPML stores translations across a fleet of custom tables, each of which can grow large on a site with serious traffic:

  • wp_icl_translations — one row per (object, language) pair. A 5,000-post site translated into three languages is 20,000 rows here, joined into nearly every front-end query.
  • wp_icl_strings and wp_icl_string_translations — the string table. Anything wrapped in __() or registered via the WPML string translation API ends up here. Themes that aggressively use __() for inline microcopy can push this into the hundreds of thousands of rows per language.
  • wp_icl_string_packages, wp_icl_string_positions, wp_icl_translate_job, wp_icl_translation_status — translation workflow state.
  • wp_icl_languages and wp_icl_languages_translations — the language registry itself.

WPML hooks into pre_get_posts, posts_join, posts_where, and the REST controllers to add language scoping to virtually every query. On a default front-end request you go from 18 SQL queries to 40-60. With the String Translation module and Translation Management both active, admin requests can cross 200 queries before object cache mitigates them.

The performance pitfalls at scale come from three places:

  1. String registration on every request. Themes that call icl_register_string() during init re-register thousands of strings on every uncached page load. The check is cheap individually, expensive in aggregate.
  2. The Language Switcher. Rendered server-side, it issues one query per language per page to resolve translated URLs. With six languages and a switcher in the header, that’s six joins on every page even for anonymous visitors.
  3. Object cache misalignment. WPML keys cache entries by language. If your object cache key prefix doesn’t include language, you get cross-language cache pollution — French visitors served English navigation, English visitors served Spanish menu labels. The fix is either WPML’s cache plugin or a manual prefix.

How to verify

Before you deploy WPML on a production site, size the string table and the query cost. On a staging copy of the database:

wp db query "SELECT COUNT(*) FROM wp_icl_strings"
wp db query "SELECT COUNT(*) FROM wp_icl_string_translations"
wp db query "SELECT language_code, COUNT(*) FROM wp_icl_translations GROUP BY language_code"

Check how much WPML is contributing to query count on a representative page:

wp eval '
define( "SAVEQUERIES", true );
$url = "https://staging.example.com/some-product-page/";
wp_remote_get( $url );
global $wpdb;
$wpml = 0;
foreach ( $wpdb->queries as $q ) {
  if ( stripos( $q[2], "WPML" ) !== false || stripos( $q[0], "icl_" ) !== false ) $wpml++;
}
echo "Total queries: " . count( $wpdb->queries ) . " | WPML-attributed: $wpml\n";
'

Anything over 40 WPML-attributed queries on a single front-end request means you have a misconfiguration or a theme that’s hammering string translation. Audit the theme’s use of icl_register_string:

grep -rn "icl_register_string\|wpml_register_single_string" wp-content/themes/active-theme/

If you find these scattered through templates that render on every page (header, footer, sidebars), move them to after_switch_theme or a one-shot registration hook.

Check your object cache for language-keyed entries:

wp cache get "alloptions" options
wp cli has-command "redis cli" && wp redis cli "KEYS *:fr:*" | head -20

If you see no language scoping in cache keys but you have multiple front-end languages active, you have cross-language cache pollution. Plan for it before traffic ramps.

The fix

The deployment proceeds in three stages: install on staging with the right module mix, prove query budget, then a cutover plan that includes object cache invalidation.

Stage 1 — install with the minimal module set.

WPML ships as a meta-package. Install only what you need:

wp plugin install sitepress-multilingual-cms --activate
wp plugin install wpml-string-translation --activate
wp plugin install wpml-translation-management --activate

Skip wpml-media-translation unless you genuinely translate media metadata per language — it adds a duplicate row per attachment per language and is the single biggest contributor to wp_icl_translations bloat on most sites. Skip wpml-sticky-links unless you have evidence of broken cross-language links; the runtime cost on every page is rarely worth the rare benefit.

Stage 2 — configure languages and URL format.

URL format matters for SEO and caching. The three options:

  • Different languages in directories (/fr/, /es/) — cleanest for SEO, plays well with CDN cache rules, recommended default.
  • A different domain per language — only if the business has separate domain assets per market. Cache key separation is automatic but DNS and TLS multiply.
  • Language as a parameter (?lang=fr) — avoid. Most CDN configurations strip query parameters from cache keys; you’ll serve cached English pages to French visitors.

Configure via WP-CLI:

wp option update icl_sitepress_settings --format=json '{
  "language_negotiation_type": 1,
  "default_language": "en",
  "active_languages": ["en","fr","es"],
  "language_per_directory": 1,
  "automatic_redirect": 0,
  "remember_language": 0
}'

Set automatic_redirect to 0. Browser-language redirect breaks crawlers, breaks campaign URLs, and is a primary cause of soft-404s in Search Console.

Stage 3 — string translation hygiene.

Auto-register is convenient and dangerous. Disable it once initial scanning is done:

wp option update icl_sitepress_settings --format=json "$(wp option get icl_sitepress_settings --format=json | jq '.st.icl_st_auto_reg = "block"')"

Then audit the strings table and prune anything from themes you’ve replaced or plugins you’ve deactivated:

SELECT context, COUNT(*) AS n
FROM wp_icl_strings
GROUP BY context
ORDER BY n DESC
LIMIT 20;

-- prune strings from a removed plugin
DELETE st, sts
FROM wp_icl_strings st
LEFT JOIN wp_icl_string_translations sts ON sts.string_id = st.id
WHERE st.context = 'plugin removed-old-slider';

Stage 4 — caching alignment.

If you run Redis or Memcached as object cache, your cache key prefix must include the WPML active language. The cleanest pattern is to use WPML’s own cache plugin or a small mu-plugin:

// wp-content/mu-plugins/wpml-cache-prefix.php
add_action( 'plugins_loaded', function() {
    if ( ! defined( 'WP_CACHE_KEY_SALT' ) && function_exists( 'apply_filters' ) ) {
        $lang = apply_filters( 'wpml_current_language', null );
        if ( $lang ) {
            define( 'WP_CACHE_KEY_SALT', 'wpml_' . $lang . ':' );
        }
    }
}, 1 );

For full-page cache (Cloudflare, LiteSpeed Cache, FastCGI cache), the cache key must include the language path segment. With language-in-directory, this is automatic — /fr/page/ and /en/page/ are distinct URLs. With domain-per-language, it’s also automatic. With query parameter, it’s not — and that’s why you don’t use the query parameter mode.

Stage 5 — the cutover.

The day of go-live, in this order:

  1. Run the WPML setup on production during a maintenance window with wp maintenance-mode activate.
  2. Run wp icl translation cleanup to remove orphaned translation jobs.
  3. Flush every cache layer: wp cache flush, then CDN purge, then object cache.
  4. Spot-check 10 URLs per language including the homepage, a product page, a blog post, and an account page if applicable.
  5. Watch wp_icl_translations row counts for the next 24 hours. Linear growth is expected. Exponential growth means a plugin is creating translation rows on every page load — usually a poorly-behaved gallery or product slider.

For ongoing translation workflow, route through Translation Management’s queue rather than letting authors translate ad-hoc in the post editor. The queue lets you cap concurrent translation jobs, which prevents the wp_icl_translate_job table from filling with dead jobs that the cleanup process later struggles to reap.


Stack Harbor runs WPML at scale on the enterprise WordPress operations operating model with object cache, full-page cache, and translation workflow tuned for content velocity. If your WPML deployment is slowing down the admin or the front end, let’s audit the install.