WordPress 4.7.4 and the ‘noopener noreferrer’ attribute

Published 29 Apr 2017 in PHP & MySQL, Security, Themes, WordPress by ZigPress

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.


  1. On 05 May 2017 at 11:37, Alexander Barton said:

    Danke dir! Ist sehr hilfreich.

  2. On 22 May 2017 at 21:35, Jalil Mehar said:

    Very Informative post.Thanks

  3. On 09 Oct 2017 at 07:21, Learn Digital Marketing said:

    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 [email protected].