Gutenberg Default New Tab Featured Image
Posted by: Johnny Comments: 0

We prefer to not take users away from important information and find ourselves setting our links to open in a new tab more often than not. This led us wanting to set the Gutenberg editor “Open in new tab” to be enabled by default. We soon discovered via a WordPress Support Ticket that this was not possible out of the box, so we set out to build a custom solution.

Table of Contents

How does it work?
How do I apply the code?
Download our Plugin
Frequently Asked Questions

How does it work?

Even though there aren’t hooks to modify this directly, after diving into the code, we found that some simple JavaScript will do the trick. Essentially, we just needed to trigger a click on the “Open in new tab” once the link button was clicked. While there were no unique id or classes associated with this button, we did find a unique attribute “aria-label”, which we could use to trigger an onclick event.

$(document).on('click', '[aria-label="Link"]', function() {})

Now we needed to trigger a click on the “Open in new tab” button, but we found that it’s input also did not have any unique identifiers, however the label itself just so happened to also be clickable, so we decided to check for the label text and trigger a click on it.

$(document).on('click', '[aria-label="Link"]', function() {
  $("label:contains('Open in new tab')").trigger('click');

From this point we just needed to enqueue the script only in the post screen.

How do I apply the code?

If you don’t have a web developer, we packed this all into an easy to use plugin which you can download below.

Download our Plugin

Stay informed on our latest plugins, marketing strategies, and more, plus get a download link to our Gutenberg Default New Tab plugin when you join our mailing list.

This field is for validation purposes and should be left unchanged.

Make sure to take a backup before installing and thoroughly test.


With a bit of Javascript code, we are able to easily set the Gutenberg “Open in new tab” option to always be enabled. We’d love to hear your thoughts or suggestions on how to make this better in the comments below. Maybe in a future version we’ll add the ability to choose what pages it integrates with.

Frequently Asked Questions About Gutenberg Default New Tab

Is there a way to always enable “Open in new tab” in Gutenberg?

Not out of the box, you’ll need custom code or our Gutenberg Default New Tab plugin.

What WordPress versions does the Gutenberg Default New Tab plugin support?

We’ve only tested the plugin on WordPress version 6.2.2, but it should work with later versions.

How can I make the Gutenberg Default New Tab plugin work on other areas such as pages?

You can reach out to your developer to add an extra condition for additional screens.

Do you plan on adding additional features to the Gutenberg Default New Tab plugin?

We built this to use for our website and our clients, but if additional needs arise, we may incorporate additional features. Feel free to leave your suggestions in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

Let's schedule a call.

A free consultation is a quick and easy way to get an understanding for your business needs.