我写了一个插件来删除博客未注册成员的链接,但是这个插件导致图片链接错误,下面是我写的内容过滤器:
if ( is_user_logged_in() ) {
// Do nothing. All is well.
} else {
$doc = new DOMDocument();
$doc->loadHTML($content);
$dom_xpath = new DOMXpath($doc);
foreach($doc->getElementsByTagName('a') as $link)
$link-