Search code examples
wordpresswysiwyg

Why is wordpress now removing form tags from the HTML editor on publish?


I'm trying to insert a paypal button using their code into the HTML tab of the wordpress wysiwyg editor. When I publish and view the source code in chrome, the form tags don't show and the button action does not happen when clicked.

The form tags do remain there in wordpress, however.

Any knowledge of why these wouldn't be carrying over? I've never had this happen, and it was working last week, same code, same project.

Could it be the newest wordpress upgrade?

It's weird because another button on another page of the same site, from paypal as well, works still..

Code from paypal:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="QLFJU8MHD2XCN">
<input type="image" src="http://www.spmoh.com/wp-content/uploads/2012/06/donate-now.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

Solution

  • The form elements are still there in the source code. I can think of two possible reasons why they are removed in the DOM view:

    • Invalid nesting of elements, for example h1 elements (that are block level elements) inside a ones. At a quick glance, I can't see anything on that page that could be causing it, though

    • JavaScript removing the elements afterwards (e.g. some rogue jQuery cleanup script).