How can I get WordPress Embeds to open in a new tab (specifically embedded plugins)

Hi guys,

I’m hoping someone here can help me with something that’s been annoying me for the last 20/30 minutes!

So, in the Gutenberg editor.

If we paste in the URL for a WordPress plugin, like this:

*https://wordpress.org/plugins/wp-smushit/*

It automatically changes to an embed, that looks like this:

​

https://preview.redd.it/17upq473wx0a1.png?width=1300&format=png&auto=webp&s=2581cd4a9690bfa669f5f0f0858a9bcf563b47ea

That’s awesome, I like it.

But, how do I get it to **open the links in a new tab?**

I have tried everything I can think of.

Here’s the code when you “edit as HTML” in the editor:

​

https://preview.redd.it/e5aar6izvx0a1.png?width=2140&format=png&auto=webp&s=4bb6a3514d4e8e014e70eb05cd295e8702982928

​

**Actual Code:**

<figure class=”wp-block-embed is-type-wp-embed is-provider-plugin-directory wp-block-embed-plugin-directory”><div class=”wp-block-embed\_\_wrapper”>

Smush – Lazy Load Images, Optimize & Compress Images

</div></figure>

&#x200B;

I’ll admit, I am a noob when it comes to coding

I did try adding **rel=”noopener”** to different parts of the code, but it kept saying “This block contains unexpected or invalid content”.

I could have been putting it in the wrong place, maybe?

*Or, that’s just totally not how you do it and I’m more of an idiot than I realised! (more likely lol)*

&#x200B;

Anyways, I’d love it if someone could help me with this.

I definitely want to use the embeds, but only if they open in a new tab.

&#x200B;

Thanks in advance,

Mr C.B.

&#x200B;

P.S.

I am pretty 50/50 if this breaks rule 9 of the sub or not tbh.

But, I’m hoping it doesn’t!

(Rule #9 = No Generic CSS/HTML questions)

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer