Why are my posts automatically modified?

  • Author
    Posts
  • #5752

    chublogga
    Member

    Why does WordPress strip out certain elements from my posts, such as <center> and style attributes??

    What I type in:

    <center>this text is centered</center>

    Here is a table with a background-image specified in the style block:
    <table id="thetable" name="thetable" style="background-image: url(http://is1.okcupid.com/graphics/politics/chart_political.gif);" border="0" cellpadding="0" cellspacing="0" height="375" width="375"><tbody>
    <tr height="31">
    <td width="212"></td>
    <td width="162"></td>
    </tr>
    <tr height="343">
    <td width="212"></td>
    <td align="left" valign="top" width="162">
    <img src="http://is1.okcupid.com/graphics/politics_you.gif" border="0">
    </td>
    </tr>
    </tbody></table>

    What gets saved:

    this text is centered

    Here is a table with a background-image specified in the style block:
    <table border="0" cellpadding="0" cellspacing="0" width="375"><tbody>
    <tr>
    <td width="212"></td>
    <td width="162"></td>
    </tr>
    <tr>
    <td width="212"></td>
    <td align="left" valign="top" width="162">
    <img src="http://is1.okcupid.com/graphics/politics_you.gif" border="0">
    </td>
    </tr>
    </tbody></table>

    #5963

    wank
    Member

    It’s being changed because inline styles are a security risk; people could sneak javascript into them and potentially hack other people’s blogs. It’s frustrating, but not quite as frustrating as being hacked.

    (On the other hand, I imagine <center>‘s getting stripped because it’s been deprecated since forever and nobody wants to whitelist it. See whether they let you have <div align="center"> instead.)

    #5975

    chublogga
    Member

    Hmm, never heard of javascript hacking via inline styles.

    Is this a danger in comments or just in posting? And if I use wordpress on my own site, can I disable that “feature”?

    And if they’re going to remove <center> for me, they should automatically replace that with <div style=”text-align:center”> – wait, that’s not allowed >:( – <div align=”center”>

The topic ‘Why are my posts automatically modified?’ is closed to new replies.