Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Vad är rel=”noopener” i WordPress? (Förklarat)

Har du funderat på vad rel="noopener ” betyder i WordPress?

När du lägger till en länk som öppnas i en new tabs, kommer WordPress automatiskt att lägga till attributet rel="noopener ” till den länken.

I den här artikeln förklarar vi vad rel="noopener ” betyder i WordPress och hur det påverkar din website.

What Is rel="noopener" in WordPress? (Explained)

Vad är rel=”noopener” i WordPress?

När du addar links till din WordPress website kan du använda HTML-attribut för att kontrollera vad som händer när du clickar på länken.

När du till exempel skapar en link finns det en toggle switch som allow you att öppna den i en new tab.

Opening a Link in a New Tab

HTML-koden som genereras av WordPress för denna link gillar detta:

<a href="http://example.com" target="_blank" rel="noreferrer noopener">external link</a>

Notera att några HTML-attribut har addats till länken: rel="noopener ” och rel="noreferrer”. Dessa attribut är add to för att åtgärda en säkerhetsbrist.

Problemet är att JavaScript-kod kan användas för att allow a new tabs to get control of its referring window. Om du länkar till en extern webbplats som påverkas av den skadliga koden kan den webbplatsen använda egenskapen window. opener i JavaScript för att ändra den ursprungliga webbsidan (på din WordPress site) för att stjäla information och sprida skadlig kod.

WordPress add rel="noopener" för att förhindra att den nya tabben utnyttjar denna JavaScript-funktion. På samma sätt förhindrar attributet rel="noreferrer ” att informationen om referrern skickas till den nya tabben.

Hur påverkar rel=”noopener” din sökmotorsoptimering i WordPress?

Det gör det inte.

Även om attributet rel="noopener" förbättrar säkerheten på din WordPress-webbplats undviker vissa användare att använda det eftersom de tror att det kommer att påverka sökmotorsoptimeringen i WordPress.

Men det är bara en myt.

Det har ingen inverkan på din sites sökmotorsoptimering eller din övergripande WordPress-prestanda.

Vad är skillnaden mellan ”noopener” och ”nofollow”?

Det är lätt att förväxla rel="noopener ” med rel="nofollow”. De är dock helt separata attribut.

Attributet noopener skyddar din website från cross-site hacking och förbättrar WordPress säkerhet.

Å andra sidan förhindrar nofollow-attributet din website från att vidarebefordra sökmotorsoptimering till den länkade webben.

Search engines letar efter och tar hänsyn till nofollow-attributet när de följer en länk på din website. De tar dock ej hänsyn till taggen noopener.

Som standard tillåter WordPress inte att du addar nofollow till dina externa links. Om du vill add to nofollow i WordPress måste du använda ett plugin.

För mer information, se vår artikel om hur du lägger till title och nofollow till länkar i WordPress.

Påverkar rel=”noreferrer” affiliate links i WordPress?

Rel="noreferrer" påverkar ej affiliate links i WordPress. Vissa användare tror att det gör det eftersom rel=” noreferrer ” förhindrar att informationen om referraren överförs till den nya tabben.

De flesta affiliate-program ger dig dock en unik URL som har ditt affiliate-ID. Detta innebär att your affiliate ID:n skickas vidare som en URL parameter för den andra website att tracka.

För det andra använder de flesta affiliate-marknadsförare ett plugin för link-cloaking för sina affiliate-länkar.

Med link cloaking är den affiliate-länk som dina användare klickar på faktiskt din websites egen URL, som sedan redirectar användarna till destinations-URL:en.

Hur inaktiverar du rel=”noopener” i WordPress?

Det finns inget behov av att remove rel="noopener ” från links på din website. Det är bra för säkerheten på din website och har ingen inverkan på prestanda eller sökmotorsoptimering på din website.

Men om du måste ta bort det måste du inaktivera Gutenberg Block Editor i WordPress och använda den klassiska editorn.

Det beror på att om du tar bort rel="noopener" från länken manuellt kommer block editor automatiskt att lägga till den igen för att hålla din website säker.

När block editor är inaktiverat måste du lägga till ett code snippet till ditt temas functions.php-fil eller till WPCode-pluginet (rekommenderas). Du kan lära dig hur du använder WPCode Free Plugin i vår guide om hur du enkelt lägger till customize-kod i WordPress.

Kopiera helt enkelt följande kod till ett nytt PHP snippet:

add_filter('tiny_mce_before_init','wpb_disable_noopener');
function wpb_disable_noopener( $mceInit ) {
    $mceInit['allow_unsafe_link_target']=true;
    return $mceInit;
}
Adding a Code Snippet Using WPCode

Se till att du aktiverar toggeln ”Active” och klicka sedan på knappen ”Save Snippet”.

Detta kommer att hindra WordPress från att lägga till rel="noopener ” till nya links. Du måste också manuellt editera alla gamla links för att ta bort attributet.

Vill du ha ännu mer control över vilka rel-attribut som läggs till i dina links i WordPress? Vi rekommenderar att du använder pluginet AIOSEO eftersom det låter dig add to title, nofollow och andra länkattribut direkt i WordPress editor.

AIOSEO Adds NoFollow and Title Attributes to the Insert Link Popup

Expertguider om hur du använder Links i WordPress

Nu när du förstår vad rel="noopener" betyder kanske du gillar att läsa våra andra guider om hur du använder links i WordPress.

Vi hoppas att den här artikeln hjälpte dig att lära dig mer om rel="noopener ” i WordPress. Du kanske också vill se vår guide om hur du får en gratis email domain, eller våra expertval för de bästa sökmotorsoptimeringstilläggen och tools för WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

27 kommentarerLämna ett svar

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Moinuddin Waheed says

    This is very helpful guide for me as I have been teaching html and css to my students and this for have not talked about these two attributes. Most of the teachers only bother to tell target equals blank attribute for opening link in new tabs.
    The best part is that we have all these options at our end in wordpress as well.
    noopener is good for security reasons as it protects from cross site hacking.
    Thanks for this detailed tutorial.

    • WPBeginner Support says

      You normally shouldn’t add that for internal links but you can if you would like.

      Administratör

  3. Navneet Kumar says

    Can we say rel=”noopener no referrer ” provide dofollow backlink to external website?

    I mean if we receive this attribute then we received dofollow backlinks or nofollow backlinks?

    Thanks in advance

    • WPBeginner Support says

      These attributes would not affect if a link is dofollow or nofollow, that would be determined if the link is nofollow or not.

      Administratör

  4. Nadya says

    is it ok to use rel=”noopener noreferrer nofollow” in any position?

    like

    rel=”nofollow noopener noreferrer”
    rel=”noreferrer nofollow noopener”

  5. Ryan says

    Thank you for your article.

    I checked my website on web.dev, and I was confused what is noopener and noreferrer.

    After I put it to all of link with target=”_blank”, my best practice score went from <80 to 86.

    Thank you.

    • WPBeginner Support says

      Glad our guide could help, don’t forget that sites with scores like that are mainly suggestions :)

      Administratör

  6. Jill says

    Hello,

    What about the custom templates used in WordPress? Should rel=”noopener” be used in the links in the custom posts templates? Especially, internal linking?

    • WPBeginner Support says

      You would not need to worry about noopener in the links to the templates for your posts and custom post types.

      Administratör

    • WPBeginner Support says

      noreferrer will prevent Google Analytics from tracking the site that the link came from.

      Administratör

  7. Lory says

    Can we use noopener but remove noreferrer? Its driving me crazy messing up my analytics. Not only can I not see referral traffic, but I also cannot see which posts have done well over time since referral traffic now shows as direct traffic to my home page. If noopener is the important tag, why is noreferrer included with it? There has to be some way around this.

    • WPBeginner Support says

      Unless I hear otherwise, we do not have a specific built-in method to set that up but there are plugins available if you are wanting to remove that from your links.

      Administratör

  8. Zol says

    Hye WPbeginner Support, O/

    I don’t use plugin to cloak my affiliate links on my website and I just manually add rel=”nofollow” to affiliate links in html editor.

    My question..is this a good practice for SEO ?
    Should I cloak it?

    Thanks in advanced for your reply.. ;)

    • WPBeginner Support says

      Hi Zol,

      It is good practice to cloak URLs. It allows you to better manage links, track your affiliate traffic, and makes your URLs look more understandable by both humans and machines.

      Administratör

  9. Shyam Mahanta says

    My wordpress have ssl certificate (auto ssl from the hosting company) but why the secure lock icon doesn’t appear in the Url? It opens in https but shows connection is not secure. Help is really appreciated.

  10. Seleno says

    Hello
    I have affiliate website and since wordpress addded noopener my earnings droped down,

    But i was not sure if it can cause this

    So noopener will never effect the affiliate links ?

    Usualy i’m removing it

    And it will not effect the seo or internal links ?
    Thanks

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.