I was pulling something from https://CJSHayward.com/books/ and found that it did not have any of the dynamically arranged titles. When I went to edit the page, I found a surprise.

I had originally entered a hand-typed:

<script src="/wp-content/javascripts/wrapped-book-table.cgi"></script>

However, while the SCRIPT tag was still there, it was mangled:

<script src="/wp-content/javascripts/wrapped-book-table.cgi" type="mce-no/type" data-mce-src="/wp-content/javascripts/wrapped-book-table.cgi"></script>

What converted the first into the second one, and what does "mce" refer to? This is not something I would have entered, and the type of "mce-no/type" probably defeated the JavaScript being treated in JavaScript.

(And what can I do to prevent the transformaation from recurring?)

  • just a quick question, did you add that into the post or into your template? – marvinpoo Apr 12 '17 at 7:48
  • 1
    Lets repeat together, the editor is for content, not for code :(. – Mark Kaplun Apr 12 '17 at 8:21
  • @MarkKaplun so true! – marvinpoo Apr 12 '17 at 8:22

This is a known bug with TinyMCE. That is the standard text editor in WP. When you hit refresh whilst editing a page it adds those tags to javascript. https://github.com/tinymce/tinymce/commit/5f320ac2acda15902b0488df1b7d85bf5c24ef94

However it is marked as fixed some time ago (2015) so perhaps your site is not up to date? Or of course perhaps it has resurfaced!

  • ...downvote was for what?! – mayersdesign Apr 12 '17 at 10:26

(And what can I do to prevent the transformaation from recurring?)

Start with not putting Javascript into your Editor.

  • What is the preferred way to add JavaScript to exactly one page? Thanks, – Christos Hayward Apr 12 '17 at 12:15
  • By assigning a custom page template to that specific page. – marvinpoo Apr 12 '17 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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