Wordpress force 'view post' to open in a new tab after publish

894 Views Asked by At

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.'

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.

1

There are 1 best solutions below

2
designtocode On BEST ANSWER

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!