Skip to content

Instantly share code, notes, and snippets.

View rupomkhondaker's full-sized avatar

Rupom Khondaker rupomkhondaker

View GitHub Profile
@LarkRiseMedia
LarkRiseMedia / functions.php
Created May 18, 2016 12:42
Remove nofollow attribute in wordpress links and text
/**
* Removes the value ›nofollow‹ from the rel attribute.
*/
function xwp_dofollow($str)
{
$str = preg_replace(
'~<a ([^>]*)\s*(["|\']{1}\w*)\s*nofollow([^>]*)>~U',
'<a ${1}${2}${3}>', $str);
return str_replace(array(' rel=""', " rel=''"), '', $str);
}