Support » Fixing WordPress » Code changes upon saving

  • Hi there,

    I’ve recently purchased the Daisho theme. They have these lovely social media icons that you can put in your footer via a text box.

    All you have to do is insert code like this:

    <ul id="social">
    	<li><a href="javascript:void(null);"><span class="social-icon">y</span></a></li>
    	<li><a href="javascript:void(null);"><span class="social-icon">t</span></a></li>
    	<li><a href="javascript:void(null);"><span class="social-icon">s</span></a></li>
    	<li><a href="javascript:void(null);"><span class="social-icon">f</span></a></li>
    	<li><a href="javascript:void(null);"><span class="social-icon">m</span></a></li>
    	<li><a href="javascript:void(null);"><span class="social-icon">r</span></a></li>
    	<li><a href="javascript:void(null);"><span class="social-icon">l</span></a></li>

    Except as soon as I click on save I see it change to:

    	<li><a href="void(null);"><span class="social-icon">y</span></a></li>
    	<li><a href="void(null);"><span class="social-icon">t</span></a></li>
    	<li><a href="void(null);"><span class="social-icon">s</span></a></li>
    	<li><a href="void(null);"><span class="social-icon">f</span></a></li>
    	<li><a href="void(null);"><span class="social-icon">m</span></a></li>
    	<li><a href="void(null);"><span class="social-icon">r</span></a></li>
    	<li><a href="void(null);"><span class="social-icon">l</span></a></li>

    I’ve disabled all plug ins although I don’t really have that many installed. What could be going wrong?

Viewing 7 replies - 1 through 7 (of 7 total)
  • There is a form that lets you paste in that code? Sounds like that is something created by the Daisho theme. Have you asked the creators of that theme for help?

  • <a href="void(null);"></a></li>
  • blocked by all major browsers (requires trusted source status) – use an up to date theme.

    I think this is because WordPress use some data validation before it insert the data into the database. See here

    If this theme use some core WordPress functions to save this content then your code can be affected by Data validation

    You can check this by creating a sample post (that you can delete later) and putting your above code there. Check the output of that post after saving

    Turns out this was the issue from the words of the Theme Developer:

    “Too bad you didn’t include info that it’s “Text Widget”. They think you’re referring to some custom field in admin panel created by us 🙂 The last reply is correct: but that’s all we know – it uses SOME validation and removes id=”” and leaves class=”” intact.

    I’ll skip investigation on why it removes id=”” and I just fixed it on your server by replacing it with class=””. It works on your server. On demo server (also WP 3.4.1) we use id=”” and it doesn’t remove it when I hit “Save” in “Text Widget”.

    The reason I suspect: your DATABASE (and not WordPress) removes that for some reason. That’s rational explanation because we both use WP 3.4.1 on test server and your server.”

    I don’t think that this is a problem with your DATABASE. He is just trying to hide his faults.

    The reason I suspect: your DATABASE (and not WordPress) removes that for some reason. That’s rational explanation because we both use WP 3.4.1 on test server and your server.”

    No way. The database does not selectively remove bits and piece of HTML. That is nonsense.

    Also, not counting functions that completely strip markup, I’ve never noticed WordPress data validation functions remove ‘ids’ while leaving ‘classes’. That makes no sense from a security standpoint. ‘ids’ aren’t security risks. Possibly if you pasted from a Word Processor (like MS Word) you may have had a weird cascade that removed the ‘ids’, but I wouldn’t bet on it. It is too targeted.

    Yes It is funny that these half-baked premium themes have more bugs and problems than free themes. 😀

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Code changes upon saving’ is closed to new replies.