realTinyMCE is not defined (50 posts)

  1. jazzle
    Posted 9 years ago #

    I really hoped 2.1.1 was going to fix this, but alas not.

    I get the titular error when trying to write a post or page with the 'Visual Editor' on.

    I'm fairly sure it's something to do with the GZIPing of the relevant JS file(s), but changing the GZIP option makes no difference to this problem.
    GZIP option does affect the main blog as it should (confirmed via whatismyip.org).

    Same problem in IE6/7/Firefox2.
    I've not done anything to the .htaccess file, nor any server settings.

    Host is Dreamhost. Blog address: http://blog.carbon-360.com/

    Any help will be much appreciated.

  2. Do you have *any* plugins activated which have Javascript files associated with them? It's possible that their scripts are interfering.

  3. jazzle
    Posted 9 years ago #

    My issue was resolved by removing all the plugins.
    Am in the slow process of bring them back one by one, but haven't found the culprit yet.

  4. tripecac
    Posted 9 years ago #

    Jazzle -

    Did your issue stay resolved? Or has the problem returned?

    I found that CTRL-REFRESH sometimes fixes the missing MCE problem, but then if I refresh repeatedly, the problem comes back.


  5. tripecac
    Posted 9 years ago #

    My guess is that the problem has something to do with the order in which Javascript blocks are being executed. If the one that needs MCE objects and methods is executed before those objects and methods are defined, we get a Javascript error.

    Shift-refreshing the browser seems to force the Javascript to run in a specific order (probably because the cache is flushed).

    Normal refreshing, however, seems to allow browser caching to interfere with the javascript execution order. I'm guessing that some of the javascript is reloaded and some is cached.

    Here's the Javascript that I see in the head of my [b]Create New Post[/b] page:

    <script type="text/javascript">
    function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
    <style type="text/css">* html { overflow-x: hidden; }</style>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-includes/js/fat.js?ver=1.0-RC1_3660'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-includes/js/prototype.js?ver=1.5.0'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-includes/js/tw-sack.js?ver=1.6.1'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-includes/js/autosave-js.php?ver=20070116'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-includes/js/dbx.js?ver=2.05'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-admin/dbx-admin-key-js.php?ver=3651&amp;pagenow=post-new.php'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-includes/js/wp-ajax-js.php?ver=20070118'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-includes/js/list-manipulation-js.php?ver=20070118'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-admin/custom-fields.js?ver=3733'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-admin/cat-js.php?ver=20070118'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-includes/js/tinymce/tiny_mce_gzip.php?ver=20061113'></script>
    <script type='text/javascript' src='http://MY-SITE.COM/wordpress/wp-includes/js/tinymce/tiny_mce_config.php?ver=20070225'></script>
  6. tripecac
    Posted 9 years ago #

    I noticed something else this morning while repeatedly refreshing the Create Post page.

    Sometimes, the visual buttons are redrawn before the other elements on the page. Sometimes they are redrawn last. Most of the times they never appear (unless I shift-refresh). Shift-refresh is slower, but usually (but not always) results in the buttons being visible; sometimes it acts just like a refresh.

    Sometimes the visual buttons are visible immediately after reload, but then they vanish. I click refresh, then the edit box changes to a darker shade of gray, then the buttons disappear and are not redrawn. So, whatever javascript or CSS changes the color of the edit box is executing, but the javascript that's supposed to add the visual buttons is *not* executing. I haven't dug through the code to find out which file does what.

    Another thing I noticed: I loaded the Create Post page in 2 tabs (in firefox). I then refreshed until one tab was "good" (with visual buttons) and one was "bad". The html for both tabs was identical except for temp_ID and hh/mm/ss data; this makes sense. None of the javascript includes differed between the "good" and "bad" tabs. So, unless those temporary and time values are making php behave fundamentally differently or the deviations are caused by javascript not running the same each time. I'm thinking the latter.

  7. tripecac
    Posted 9 years ago #

    I did a side-by-side comparison of the "bad" page and "good" page using firefox's DOM inspector. Here's what I found:

    1) The "good" page has 2 extra elements at the very end of the body tag:

    <div id="mc_menu_0" class="mceMenu">...</div>
    <div id="mc_menu_1" class="mceMenu">...</div>

    2) The "good" page has an extra span inside of the last div within #postdivrich:

    <span id="mce_editor_0_parent" class="mceEditorContainer">...</span>

    There might be other differences, but those are the two ones I noticed.

    I guess the next steps are to find out:

    1) which javascript is response for adding these elements
    2) why that javascript is not getting executed for the "bad" page

  8. tripecac
    Posted 9 years ago #

    Okay, I found the code for adding the mce elements. It's in wp-includes/js/tinymce/tiny_mce.js. That's a huge file, with huge functions, and prototyping, which I've never used. I think we'll need someone familiar w/ prototyping if we're going to try to debug it.

  9. tripecac
    Posted 9 years ago #

    In case you are wondering, WordPress 2.1.3 does not fix the problem. I get the same disappearing visual buttons after upgrading.

  10. tripecac: Have you checked your site for any other javascript files, as part of plugins or perhaps as part of your theme?

    This is not a WordPress problem, per se. See, WordPress 2.1 started including the scriptaculous scripts as part of the default package. But a lot of older plugins and themes also included versions of these scripts, since older versions of wordpress did not have them. These differing versions interfere with one another, and one of the pretty common occurrences are the problems you are describing.

    Disable your plugins. Look for extra javascript code in the site. Remove it. The problem will go away only when you do this sort of thing.

  11. Simpele
    Posted 9 years ago #

    In my case, Theme Switcher (http://386a.net/wordpress/theme-switcher/) messed things up.

  12. tripecac
    Posted 9 years ago #

    Hi, thanks for the info!

    Something weird just happened. When I started up Firefox (with the same tabs as last time, which was a week or so ago), my "Create New Post" page was missing the visual buttons and had javascript errors. This itself wasn't surprising. Here's the interesting bit:

    After reading the responses to this topic, I decided to check my Firefox Ad-Ons. I ran the updater and saw that there is a new version of NoScript. I updated NoScript (to and restared Firefox...

    ...and now, the visual buttons are always there. I refreshed 20+ times and they never disappeared. Weird. So maybe NoScript was interfering with the loading of MCE javascript (even though I wasn't blocking it)? Or maybe my browser is just having a "lucky streak"...

    I'll restart Firefox and try again to see if I can get the MCE buttons to disappear. Unless you hear back from me today, you can assume that I wasn't able to reproduce the problem anymore.

    Even if I have 100% success today, I'll post another update again here in a few days to let you know if the success rate is still 100%. If so, then maybe the problem was NoScript. Maybe. I'll keep you posted!

  13. Andrew Ozz
    WordPress Dev
    Posted 9 years ago #

    tripecac, you're right... It was after all FF's NoScript fault. I had to keep refreshing the page too to get tinyMCE back. Changelog from NoScript's site:

    x Fixed weird intermittent interference with dynamic JavaScript
      inclusion via document.write() used by some JavaScript libraries
      (e.g. Prototype, Dojo or Tiny-MCE)
  14. melkior
    Posted 9 years ago #

    For me, ImageManager was the conflictual plugin. Desactivating all my plugins brings back the TinyMCE editor. I don't quite understand though cause I started using ImageManager et Wp-Lightbox together and all was working fine. Now I get the same error as you guys as far as I keep IM activated.

  15. tripecac
    Posted 9 years ago #

    I just updated NoScript to on another PC and the MCE buttons are working there too. Yay! So, problem solved (hopefully!)

  16. Stelzner
    Posted 9 years ago #

    For me, I am having this problem ALL of a sudden.

    I tried FireFox, Safari, IE on Mac and Windows and it does not go away.

    Even when I deactivate all of my plugins, the problem still exists.

    I have a friends blog that I can use fine and get the rich editor.

    Here is what I have determined:

    1. The tiny mice javascript is not referenced in my files and is in my friends
    2. This <fieldset id="postdivrich"> is also missing in mine

    I totally deleted all of the files and reposted my blog and the problem still exists.

    Anyone have any ideas??


  17. Stelzner
    Posted 9 years ago #

    FOLKS- Found a possible solution:

    Your Profile if the WYSIWYG-Editor is checked so it is on. If not, check it and save changes.

  18. The NoScript issue was actually discovered a couple of days ago here:


    Props to g30rg3x and the NoScript devs for fixing the issue.

  19. saphod
    Posted 9 years ago #

    Same problem with me here:

    all of a sudden (although working fine before), the icons for formatting the text were no longer shown in the visual editor and I couldn't switch between "visual" and "code".

    I deactivated all plugins and reactivated them one by one.

    If WP-ContactForm (v1.4.3 by Ryan Duff) is activated, the problem appears. If it is deactivated, it's all good.

    Does anyone know a similar plugin that'll actually work with WP 2.1.3?

  20. MacAddict
    Posted 9 years ago #

    Yeah.. I had similar problems here after upgrading. The visual editor used to work, then stopped working after upgrading to 2.1.3

    I swept back through my plugins, turning them all off, then one by one back on, and now things are normal again.

    Not running any off the wall plugins.. just:
    Spam Karma
    wp-polls + widget

    Strange that just turning them on and off would fix it. Hope it stays fixed, but I will repost if it 'breaks' again...

  21. talgalili
    Posted 9 years ago #

    it is not working for me either.
    I am using WP 2.1.3, tried to turn off all plugins, including refreshing with shift and ctrl - and none of it helped.

    I keep getting:
    line: 44
    char: 2
    Error: 'realtinymce' is undefined
    code: 0
    url: <omitted...>/wp-admin/post-new.php

    any thoughts ??

  22. freelantz
    Posted 9 years ago #

    Same problem here in 2.2

  23. ManiKomiO
    Posted 9 years ago #

    Hi, I've got a problem with the visual editor of WordPress.
    In localhost everything works perfectly but in my hosting phpnet.us the visual editor doesn't work. I get the following message in the Error Console:"Error: realTinyMCE is not defined
    Archivo de origen: http://manikomio.phpnet.us/wordpress...p?ver=20061113
    LĂ­nea: 43"

    I've tried to find a solution in lots of Forums but no post was helpfull. I think this has something to do with the hosting service, the permissions or something else...I really don't know.

    Can someone help me with my problem?

    Thanks a lot

  24. Octav
    Posted 9 years ago #

    For the non-technical just trying to fix their blog, the quick fix is:


    1. Open /wp-includes/js/scriptaculous/wp-scriptaculous.js in your favourite editor
    2. Comment or delete the last line. Example:


      make it look like:

      // Scriptaculous.load();

    What really happens is that the TinyMCE script tries to find the url it is loaded from (look in /wp-includes/js/tinymce/tiny_mce_gzip.php line 257). Because of some weird problem caused by the Scriptaculous library, all of the script tags that are located after the Scriptaculous one in the source are removed from the DOM (become invisible to calls like document.getElementsByTagName("script")). TinyMCE has trouble finding the url because TinyMCE is *usually* loaded after Scriptaculous, so the visual editor won't work. In some cases, if you hit refresh enough times, you might cause TinyMCE script to be loaded before Scriptaculous and then it would work.

    Now, the problem with Scriptaculous resides in the following code, which handles loading additional libraries via the load= parameter (see /wp-includes/js/scriptaculous/wp-scriptaculous.js), specifically:


    $A applied to the scripts collection seems to cause the weird side effect of removing some from the DOM. $A comes from the Prototype framework and should normally extend the DOM objects with additional functionality. I am not sure if this weird script-disappearing thing is a known issue with the Prototype framework, so maybe somebody can comment on that.

    Anyway, the fix I presented will prevent the buggy code from being run. It is not needed because the libraries are loaded one by one, manually. Some workarounds presented earlier might work also, but this seems to be the cleanest way.

  25. Ron
    Posted 9 years ago #

    I tried pretty much everything here...

    Upgrades, removing plugins, adding plugins, the scriptaculous onLoad bit etc.

    NONE of the wordpress sites I work with seem to have the rich text editor coming up (enabled in user profile). I've tried IE7, FF2.0.0.4, Safari 3.0.1 (windows) and Opera 9.21.

    I only run the windows firewall (and am double routered (is that a word?) I run avast anti-virus, and no active spyware protector (X-cleaner runs on boot, and I manually run adaware a couple times a week). Oh ya XP sp2 auto update running.

    The code helper works just fine, and I'm well versed in xhtml and css so have relied on that for the past 6 to 8months. I only noticed this when I was trying to walk a client through the rich text editor. They see it fine I cannot.

    Any clues?

  26. ianjohn27
    Posted 9 years ago #

    So I had a similar problem, but it was definitely an issue with the server not supporting gzip properly. (Everything worked on my local server). I went in to this file:


    and found this code:

    if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression') && ini_get('output_handler') != 'ob_gzhandler') {
    $enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
    $supportsGzip = true;

    Immediately after I overrode the $supportsGzip var with a false value by inserting the following line after the block reference above:

    $supportsGzip = false;

    Bingo! everything works fine now.

  27. mmm07
    Posted 9 years ago #

    In this way I resolved the problem! Thanks a lot! Ciao ciao

  28. arizk
    Posted 9 years ago #

    thanks ianjohn27, that worked for me too! Seems pretty hack-y though. Is this the 'right' way to fix the problem?

  29. pxc
    Posted 9 years ago #

    Thanks ianjohn27, that worked like a charm. They should include the GZIP option in their next releases.

    Strange, cause my server does accept GZIP:
    _SERVER["HTTP_ACCEPT_ENCODING"] = gzip, deflate

    Thanks again!

  30. bastischubert
    Posted 8 years ago #

    had the problem today that could be fixed with the gzip workaround.

    then i discovered that the problem was a blank line after ?> in the wp-config.php which produces an empty line of output and screws up the gzip detection stuff, rss feeds and so on.

    when i restored the tiny_mce_gzip.php to the default (with the fixe provided here) and cleaned up wp-config.php everything worked fine ;)
    so look out for initial empty lines in the output of your blog ;))

Topic Closed

This topic has been closed to new replies.

About this Topic