I just installed WP 3.1 Beta 2 on my test server. I noticed that it ships with a new l10n.js file that gets automatically inserted into the header.

I did a bit of digging and it has something to do with localization. I'm guessing that many people don't use this, so I'm wondering how I could remove it?

If it's important not to remove it, please let me know as well.

8 Answers 8


It contains the convertEntities() function that (as the name says) converts HTML entities to their actual value. It is mostly used for scripts that send over localization data from PHP to the JS side using wp_localize_script(). Just search for l10n_print_after in the code base and you see it a lot.

The data you add in wp_localize_script() is added before the script it translates (it must be, because it is referenced there). However, if you use a script concatenator (so you only have one request that returns all used JS files), this one file would also be called after all localized data - but now convertEntities() is not defined when we need it. For this reason this function is split off the general utils.js file and added with a high priority at the top.

For this reason you should not remove it: all scripts that use translatable strings use it (even if they are still in English), and you might break places that still have entities.

  • 1
    Thanks for elaborating so well! :) Still have some questions though. My main concern is just adding another unnecessary request for each user on the front end. The only JS users see is my own simple scripts.js and jquery. I don't mind l10n appearing in the WP Dashboard, but the site I'm working on gets a large amount of traffic and I'm being super picky about keeping it all optimized. Someone mentioned an Admin Bar as the cause, but only a few authors for the site. I don't care if it affects them, just don't want that to slow the rest of the site down. What do you suggest doing? Commented Dec 17, 2010 at 7:54
  • 1
    So it looks like wp_register_script is triggering l10n.js to load even if I have ZERO .js files enqueued. I don't mind if it loads for authors, who are low-traffic, but it loads on public pages for regular visitors even if I serve no javascript to them. Even if I were to need a script like jquery, it shouldn't need to depend on utils.js. It never did in the past for the front-end at least. Commented Dec 18, 2010 at 23:39
if ( !is_admin() ) {
function my_init_method() {
wp_deregister_script( 'l10n' );
add_action('init', 'my_init_method'); 

use the code above to deregister l10n.js in function.php


Looks like it is included when you enqueue the 'comment-reply' scrip. Note that you probably want to make sure 'comment-reply' is loaded only on pages could have comments enabled (e.g. check is_singular() before enqueueing the script).

  • Hmm, I don't think it has anything to do with the comment-reply script. I don't have that it enqueued on my test site at all actually at the moment. It appears on any and every page of the site. I even switched back to WP 3.0.3 to test and it goes away. Comes back if I run the new 3.1 beta 2. Commented Dec 16, 2010 at 6:08
  • I am only seeing it on pages that are enqueueing comment-reply on both of my testbeds running the SVN trunk version of WordPress.
    – mtekk
    Commented Dec 16, 2010 at 19:44

I found on my installation that this script was loaded alongside the new admin bar, getting rid of the admin bar got rid of the l10n.js for me(but i think Jan's answer is more inline with answering the "why").

Removing the bar was easy..

remove_action( 'init', 'wp_admin_bar_init' );

This doesn't actually address the question(as evidenced by the other answers), but incase anyone wants to remove that awful bar, the above is how you do it..

  • Hmm something else in my code is triggering it as well. I created a super basic theme with just header/footer/index/sidebar.php and that remove action solved the problem. But on my regular theme, even if I remove all the enqueues, it still keeps loading. I have ZERO javascript in WP head/footer aside from google analytics which is hard coded into the template anyways. Commented Dec 17, 2010 at 7:49
  • 1
    With the default theme enabled, no plugins(or minimal), i see absolutely no scripts loaded front side when i remove the admin bar. I think Jan has posted some crucial information regarding when and why this script is called(i was only speaking with regard to removing it, and posted what i found worked).
    – t31os
    Commented Dec 17, 2010 at 9:50
  • Okay so here's what I found after a bit more experimenting. I had some wp_register_script statements in my functions.php. That triggers l10n.js to appear even if I never enqueue any .js files. I have the Admin Bar disabled as well! Commented Dec 18, 2010 at 23:32

How to remove it:

function kill_l10n() {
    if ( !is_admin() )
        wp_deregister_script( 'l10n' );
add_action( 'wp_print_scripts', 'kill_l10n' );

Drop in functions.php or whatever (plugin, etc.)

Works for me.


To remove it add the following to your theme's functions.php file.



Developers source for the file has following description:

//Used to ensure that Entities used in L10N strings are correct

and commit note says:

Move the l10n helper function into a seperate js file so we can always output it first.

I hadn't played with 3.1 yet so not sure what can make it load in every page.

  • Yup I found that file, but didn't find any more details. I thought something odd in my theme was triggering it. So I tried the default twentyten theme and it had it as well. It looks like it's thrown into wp_head automatically by WP v3.1 Commented Dec 16, 2010 at 9:37

Yep it's thrown inside the theme by wp_head automatically... I remove it by placing the code below in the theme's functions.php

remove_action( 'wp_head', 'l10n' );

Not the answer you're looking for? Browse other questions tagged or ask your own question.