[wp-trac] [WordPress Trac] #53839: Add rel="noopener" to output of wp_list_bookmarks() when target is set to "_blank"

WordPress Trac noreply at wordpress.org
Mon Nov 8 18:51:12 UTC 2021


#53839: Add rel="noopener" to output of wp_list_bookmarks() when target is set to
"_blank"
-------------------------+---------------------
 Reporter:  tw2113       |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  5.9
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+---------------------

Comment (by costdev):

 == Test Report

 === Env
 * WordPress 5.9-alpha-20211102.234109
 * Chrome 95.0.4638.69
 * Windows 10
 * Theme: Twenty Twenty One
 * Gutenberg Editor
 * Plugins: None

 === Steps to test
 1. Enable the Link manager by adding this to your theme's `functions.php`
 file:

 {{{#!php
 // Enable link manager.
 add_filter( 'pre_option_link_manager_enabled', '__return_true' );

 // Display bookmarks on frontend.
 if ( ! is_admin() ) {
         wp_list_bookmarks( '' );
 }
 }}}

 2. Refresh the Dashboard.
 3. Navigate to **Links > Add New**.
 4. Create a link, assign it to a category (create a new category if none
 exist) and publish.
 5. Under **Target**, select `_blank`.
 6. On the frontend, open up DevTools (or right-click on the bookmark and
 click "Inspect").
 7. You should see that the link should contain `rel="noopener"` and look
 similar to this:
 {{{
 <a href="http://wordpress.org" rel="noopener" target="_blank">With
 _blank</a>
 }}}

 === Results
 - Patch:
 [https://core.trac.wordpress.org/attachment/ticket/53839/53839.patch
 53839.patch]
 - Before patch: The bookmark with `target="_blank"` did not have
 `rel="noopener"` in its attributes.
 - After patch: The bookmark with `target="_blank"` did have
 `rel="noopener"` in its attributes.
 - Result: Patch works as expected. No regressions identified.

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


More information about the wp-trac mailing list