[wp-trac] [WordPress Trac] #61482: WordPress is adding rel="noopener" to code in normal texteditor

WordPress Trac noreply at wordpress.org
Sun Jun 23 10:51:16 UTC 2024


#61482: WordPress is adding rel="noopener" to code in normal texteditor
--------------------------+------------------------------
 Reporter:  neo2k23       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by deepakrohilla):

 By default all links with a target of _blank will get a rel attribute of
 noopener. This will disable access to the window.opener object from a
 child tab/window that will open on click. If this is not something you
 care about, you can disable this option, by setting it to false. Although
 we do not recommend you to do so unless you have other ways of securing
 links to external pages using target set to _blank.

 Type: Boolean

 Default value: false

 Possible values: true, false

 Example: using allow_unsafe_link_target
 tinymce.init({
   selector: 'textarea',  // change this value according to your HTML
   allow_unsafe_link_target: true
 });

 well there is no need to remove rel="noopener" from links on your website.
 It is good for your website’s security and has no performance or SEO
 impact on your website.

 But if you really want to remove it you have to add_filter on the_content
 like.


 {{{
 function remove_noopener_from_post_content($content) {
     // Replace rel="noopener" with an empty string
     $content = str_replace('rel="noopener"', '', $content);

     return $content;
 }
 add_filter('the_content', 'remove_noopener_from_post_content');
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61482#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list