WordPress force ‘view post’ to open in a new tab after publish

My users are creating posts on the ‘front’end’ of wordpress, and are doing this within an custom styled iframe overlay.

After publishing the post, the standard message appears ‘Post updated. View Post.’

Read More

Because the user is in an iframe overlay, clicking view post keeps them within the iframe and breaks the experience.

I’d like to force the ‘view post’ button in a new tab with _blank, but I assume this needs to be a function, I can’t find a way to do it. Alternatively, hitting view post could close the iframe and go to the post.

Related posts

Leave a Reply

1 comment

  1. Links in iframe’s work different, by default they will open in the iframe. You need to set the anchor’s targets.

    This will open it in the parent window:

    target=_parent
    

    This will open it in a new window/tab:

    target=_blank
    

    This will be some custom editing in your theme files. So if you’re good with PHP and HTML, you wont have an issue!