Remove rel attribute added by Gutenberg WordPress

Remove rel attribute added by Gutenberg WordPress

March 6, 2020

REMOVE REL ATTRIBUTE ADDED BY GUTENBERG, GUTENBERG automatically add rel attribute to the Anchor tag.

Please add the below code in your theme functions.php

//remove rel="noopener noreferrer" added in anchor tag
//below will remove from content and comments
//if rel is different just change rel in code
function remove_nofollow($string) {
	$string = str_ireplace(' rel="noopener noreferrer"', '', $string);
	return $string;
}
add_filter('the_content', 'remove_nofollow');
add_filter('comment_text', 'remove_nofollow');

Please let me know if it works for you. If any issue I will fix my code.

Share This Story, Choose Your Platform!

Lets Discuss On Your Store