0

I'm creating some pretty involved websites where I insert the contents of a wordpress 'page' directly into a page display element. (example would be a custom entry in the footer...) Its absolutely essential that we can use html code within our pages without errors. This enables our admins to make minor upgrades without having to recode a template. Generally they add or edit links or images on the site, nothing more fancy than that.

Unfortunately I'm having lots of issues with content being mangled upon delivery. (inspected in firebug or chrome dev tools.) Not sure what is going on.

I'm very well aware of the TinyMCE Advanced Plugin from Andrew Ozz. Got that puppy plugged in and I'm using the HTML button as well as the setup checked for "Stop removing the <p> and <br/> tags when saving and show them in the html editor" The system still generates the <p> tags, but at least I can see where they are.

I'm also familiar with https://codex.wordpress.org/TinyMCE#Customize_TinyMCE_with_Filters At first four glances it would appear that any customization mods done via the codex would interfere with the Ozz TinyMCE Advanced Plugin, so I've shut any custom work there. I've also verified that the theme I'm using isn't doing the mangling. In fact when I check what's stored in the page, it looks clean there. What's not clean is the output on the web page.

Here is a simple example, a html comment symbol. The sample is <!-- hide this link -->. The html view button shows EXACTLY this code. When you go to the web page and look at the generated code you get <!-- and &#8211;> The --> is converted to garbage. Same thing happens to a lot of my characters, single quotes get changed to &#8216; and &#8217, double quotes to &#8220; and &#8221

Anybody know what is going on? Is this an ascii vs UTF issue? Is this a database setup error, perhaps using the wrong character storage type? I just checked the database and phpMyAdmin tells me that the "Server Connection Collation" is "utf8_general_ci". Is this correct? Ouch.. I just checked the data within the database, and the errors are not apparent there. --> looks just like -->.

Many thanks for any insight you guys might provide.. Zip.

  • Have you tried disabling all plugins? – czerspalace Mar 18 '14 at 7:26
  • Great idea. Just finished attempting that with mixed results. I shut off ALL the plugins, and switched to the Twenty Fourteen theme. All of my customization is in a child theme to a totally different elegant theme template (divi). Got the html comment thing to work, but other stuff still fails... && gets turned into &#038;&#038; Its better but still not quite there. Any suggestions on what to do? Something is changing my characters. Do note I get same results on Chrome as on Firefox. – zipzit Mar 18 '14 at 8:33
  • This whole thing is rather odd. I've got different sites out there, all give the same result. Stick this brief test on your site.. what do you see? '<!-- Can you see me? && -->' When I pull the code out of the post, and insert it into a text widget, I get no errors. Oh, and the code I was using, it was a simple javascript to show me the size of the current window. I'm working on my @media CSS stuff right now... – zipzit Mar 18 '14 at 15:32
  • It looks like that is caused by the wptexturize core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/… function and there doesnt seem to be a way to avoid converting the ampersand – czerspalace Mar 18 '14 at 20:09
  • Thanks to czerspalace for the info. Ouch. I never realized that's how the wordpress core updates were managed. That file has some ugly Regex's in there, nicely commented. Many thanx. I've now moved 'custom code' used for testing away from posts and pages, and into the text widget. Code in a widget text box doesn't seem to get mangled. You can turn them on and off easily enough, as well as store unused widgets. – zipzit Mar 19 '14 at 0:47

Your Answer

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

Browse other questions tagged or ask your own question.