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;
}
add_filter('tiny_mce_before_init','my_tiny_mce_before_init');

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

3 Comments

  1. Danke dir! Ist sehr hilfreich.

  2. Very Informative post.Thanks

  3. Nice post, things explained in details. Thank You.

Add a Comment

If you have used this form and would like a copy of the information held about you on this website, or would like the information deleted, please email info@zigpress.com.