Skip to content

Instantly share code, notes, and snippets.

@Log1x
Created March 7, 2019 16:38
Show Gist options
  • Save Log1x/972ec0a4a079ff6b5b5d746b172b5385 to your computer and use it in GitHub Desktop.
Save Log1x/972ec0a4a079ff6b5b5d746b172b5385 to your computer and use it in GitHub Desktop.
Remove noopener & noreferrer on WordPress links
/**
* Remove rel="noopener noreferrer" in TinyMCE links
*
* @param array $init
* @return array
*/
add_filter('tiny_mce_before_init', function ($init) {
$init['allow_unsafe_link_target'] = true;
return $init;
});
/**
* Prevent rel="noopener noreferrer" from automatically being added on post save.
*
* @return void
*/
add_filter('wp_targeted_link_rel', function () {
return;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment