WordPress 4.7.4 and the ‘noopener noreferrer’ attribute

Some of you may have noticed that after you upgrade to WordPress 4.7.4, when you edit a post using the visual editor tab and add an internal link (a link to another page or post on your site) with a target=”blank” attribute, WordPress’s TinyMCE editor adds the following attribute to the link:

rel=”noopener noreferrer”

This has been touted as a security measure but for many people it is seriously messing up their referral tracking and analytics.

Fortunately it’s easy to disable, simply by adding the following code to your theme’s functions.php file (if you’re using a child theme, add it to the functions.php file in the child theme, not the parent theme).

function my_tiny_mce_before_init($mceInit) { $mceInit['allow_unsafe_link_target'] = true; return $mceInit;

So if you don’t want this attribute to be added by WordPress, you now have a way of removing it.

Share Button

Posted by Web Monkey