# Skip Loading Translations on English Sites

> Stops WordPress, plugins and themes from loading translation files on the front end (or everywhere) to save memory and time on sites whose visitors read English anyway, with a list of text domains to keep.

- Type: PHP
- Runs: Run everywhere
- Category: [Performance](https://wpide.com/library/category/performance/)
- Tags: performance, translations, memory, i18n
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/skip-translations-on-english-sites/

## Code

```php
// 'frontend' skips translations on public pages only. 'everywhere' also skips them in wp-admin.
$wpide_skip_translations_on = 'frontend';

// Text domains that still load their translations, for example 'default' (WordPress itself) or 'woocommerce'.
$wpide_keep_text_domains = array();

$wpide_skip_translation = function ( $domain ) use ( $wpide_skip_translations_on, $wpide_keep_text_domains ) {
    if ( in_array( $domain, $wpide_keep_text_domains, true ) ) {
        return false;
    }

    if ( 'everywhere' === $wpide_skip_translations_on ) {
        return true;
    }

    if ( is_admin() || wp_doing_ajax() || wp_doing_cron() || ( defined( 'WP_CLI' ) && WP_CLI ) || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
        return false;
    }

    if ( isset( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) {
        return false;
    }

    // REST requests are not flagged yet when the first translations load, so check the address too.
    $uri = isset( $_SERVER['REQUEST_URI'] ) ? (string) wp_unslash( $_SERVER['REQUEST_URI'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput

    return ! isset( $_GET['rest_route'] ) && false === strpos( $uri, '/' . rest_get_url_prefix() . '/' ); // phpcs:ignore WordPress.Security.NonceVerification
};

// PHP translation files (.mo and .l10n.php).
add_filter( 'override_load_textdomain', function ( $override, $domain ) use ( $wpide_skip_translation ) {
    return $override || $wpide_skip_translation( $domain );
}, 10, 2 );

// JavaScript translation files (.json).
add_filter( 'pre_load_script_translations', function ( $translations, $file, $handle, $domain ) use ( $wpide_skip_translation ) {
    return ( null === $translations && $wpide_skip_translation( $domain ) ) ? false : $translations;
}, 10, 4 );
```

## Notes

Only makes a difference when the site or user language is not English (United States), for example English (UK), or when plugins ship translations you never show. With 'frontend', wp-admin, the login page, AJAX, REST, cron and WP-CLI keep their translations. Add 'default' to the keep list to keep WordPress's own strings (dates, comment form) translated. Translations a plugin loads before WPIDE runs snippets are not affected.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Skip Loading Translations on English Sites" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
