Created
June 22, 2015 08:19
-
-
Save icetee/e380f5426b55293b0c32 to your computer and use it in GitHub Desktop.
remove_a_tag() in Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function remove_a_tag($string, $postid, $slug = true) { | |
$return = array(); | |
preg_match_all("/<a.*?>(.*?)<\/a>/", $string, $matches); | |
foreach ($matches[1] as $key => $value) { | |
if ($slug == true) { | |
$return[] = sanitize_title($value); | |
} else { | |
$return[] = $value; | |
} | |
} | |
return $return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment