Everything was working well, but somebody wrote a post with the following inside:

<iframe blablabla (a video) </iframe>
<div style="clear: both; height: 3px; width: 592px;"></div>

I think that clear: both was causing that the sidebar was being moved to the bottom as the following image displays:

image description

I added the following code to the css of the theme (the theme is using Twitter Bootstrap, by the way):

.container:after {
    clear: none;

That code worked and the sidebar is in its place. However I understand it is just a work around, so more problems are probably coming because I think I did not fix the root of the problem.

I think the code within any post should not affect anything outside that post. So I guess some tag is not closed. I did not found more tags without being closed though.

Does WordPress protects against code written within a post? What could be the root of the problem?


This is a shot in the dark because I can't see the site... Check the way your theme uses css to align your sidebar and see if the width that is being set to the div by the user is causing the post container to become too wide, pushing the sidebar down. You could use some css to control elements within the posts container such as:

I would try to find the root in your theme's css or template design. Maybe you are missing a closing .

Well, hopefully this sparks something that helps you resolve this. If you can post a link we'll be able to figure it out for you faster.

*EDIT 4-23

I would say the protection for something like this is not a feature of Wordpress but dependent on the theme in use following template design guidelines. ANyone skilled in inline css and html can break any template using the post or page editor. There is such a variation of templates out there that are not designed by reputable Wordpress theme designers that it is hard to say what the root issue is in your instance but I bet it lies in the theme's design combined with the inline html placed in the editor. I would wager that a more well designed template would be built in a way that makes this harder to occur. Using standard cross browser and device compatibility rules will go a long way in preventing this kind of thing. Are you using a particular theme that I can download and test against my hypothesis?

*Also try adding this to CSS and it may resolve your issue:

iframe { max-width: 100%; }

  • Appreciate the attempt. But can you address the question: "Does WordPress protects against code written within a post? What could be the root of the problem?" If you can say how to restrict code in posts, then you'll have a good answer here. :)
    – Caspar
    Apr 22 '16 at 20:25
  • Maybe it's me the one who has broken the theme. The theme is a modification of this one: wordpress.org/themes/hipwords This is the website with the modified theme: radioqk.org
    – chelder
    Apr 27 '16 at 10:42

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.