Possible Duplicate:
PHP Dom Remove element leave contents
I'm adding a function to a WordPress theme's function.php
.
I want to have it strip links from markup, something like this:
function clean_content($content) { <br>
$content = preg_replace('some regex goes here, but what?', '', $content);
return $content;
}
add_filter('the_content', 'clean_content', 1);
What is the regex for stripping links but keeping the rest of the markup, but only for links from certain domains?
Per example, I want to strip all links that contain google.com
in the href
attribute, but keep the markup and text (e.g.: <img>
for image links, etc.).
Thanks, thanks, thanks!