Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have an error generated from thickbox loading on every page including the admin area. This is being printed into the html

<script type='text/javascript'>
<![CDATA[ */ var thickboxL10n = {
next: "Next &gt;", prev: "&lt; Prev",image: 
"Image",  of: "of", close: "Close", 
noiframes: "This feature requires inline frames. You have iframes disabled or your browser does not support them." }; 
try{convertEntities(thickboxL10n);}catch(e){}; /* ]]> */ </script> 

I would not really care but it is breaking firefox which sucks when the project is mid-development. The problem is here:

convertEntities is not defined

Line 55 try{convertEntities(thickboxL10n);}catch(e){};

I tried to just stop it with a function

 function conditional_thickbox() {
  global $post;
  if (is_singular() &&
    strpos($post->post_content,'class="thickbox"') !== false) {
      wp_enqueue_script('thickbox');
      wp_enqueue_style('thickbox');
  }
}
add_action('wp_print_styles','conditional_thickbox');

That works well but it removes from everywhere and I realized this is a dependency for Wordpress image upload functionality.

I think I found the fix here :

http://core.trac.wordpress.org/attachment/ticket/16227/convertEntities-Firebug-Fix.diff

Which requires me hacking the core, any ideas on the best way to fix this ?

share|improve this question
    
Don't see that problem with Firebug myself, what other firefox addons are you running and/or plugins in WordPress? Tried with plugins disabled or with firefox addons disabled(minus firebug of course)? –  t31os Feb 12 '11 at 8:57

1 Answer 1

up vote 0 down vote accepted

The convertEntities function was defined in utils.js, but if you use script concatenation this file would be included after it is needed. Because it was in a try-catch clause, the error was not (always) noticed.

The solution is to include the convertEntities function before this code is loaded. In WordPress 3.1 this is now included in l10n.js, which you cannot disable. A quick and dirty solution would be to copy this code and write it at the top of each page, so you are sure it is available.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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