WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When you choose "Preview", which is actually a link,

<a class="preview button" href="?p=52&amp;preview=true"
id="post-preview" tabindex="4">Preview</a>

the post is saved and the preview opens in a new window.

I'm sure there is a javascript event attached to this button, I'd like to override it so that it saves and then preview link opens in the same tab / window.


share|improve this question
up vote 3 down vote accepted

Here's a way to do it without modifying the core:


function preview_same_window(){ ?>
    <script type="text/javascript">





share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.