As I am no programmer, I'll provide info that produces the problem:
I use some javascript code to break my site out of foreign frames. This code conflicted with preview feature of the internal WP editor because the post tried to break out from the preview frame.
After, suggestion from people in the IRC channel, got it to work by editing the code in header.php file to the following:
<?php if ( !is_preview() ) { ?>
<script type="text/javascript">
<!--
if (parent.frames.length > 0)
{
parent.location.href = location.href;
}
-->
</script>
<?php } ?>
Expected Results:
Whenever I try to edit a draft or a published post, the javascript code should not be executed.
Actual Results:
When I edit:
- drafts: the js code is not executed
- published posts: the js code is executed
- private posts: the js code is executed
Reproducible: always
Steps to reproduce:
- Add the above sample code to the header.php file, inside the head HTML tags.
- Write a sample post and save it as a draft.
- The draft can be editited
- Publish the draft either as a private or public post
- Editing it is not possible, as the js code is executed and breaks the preview out of the frame
Seems that when editing drafts the is_preview() value is true, but when editing published posts the is_preview() value is false.