OP提供的其他信息似乎OP“忘记”告诉他,他使用了以下插件:
<?php
/*
Plugin Name: Remove Links in Comments
Plugin URI: http://www.stefannilsson.com/remove-links-in-comments/
Description: Deactivate hyperlinks in comments.
*/
function remove_links($string = \'\') {
$link_pattern = "/<a[^>]*>(.*)<\\/a>/iU";
$string = preg_replace($link_pattern, "$1", $string);
return $string;
}
add_filter(\'comment_text\', \'remove_links\');
修改后的插件
要使其工作,我们必须稍微修改一下:
<?php
! defined( \'ABSPATH\' ) AND exit;
/* Plugin Name: (#66166) »kaiser« Extend allowed HTML Tags for Admin <strong>only</strong> */
function wpse66166_extend_allowed_tags( $post_id )
{
global $allowed_tags;
// For Admin users only
if (
! current_user_can( \'manage_options\' )
OR is_admin()
)
return add_filter( \'comment_text\', \'wpse66166_remove_links\' );
if ( ! is_array( $allowed_tags ) )
return;
return $GLOBALS[\'allowed_tags\'] = array_merge(
$allowed_tags
,array( \'a\' => array( \'href\' => \'title\' ) )
);
}
add_action( \'comment_form\', \'wpse66166_extend_allowed_tags\' );
function wpse66166_remove_links( $comment )
{
return preg_replace(
"/<a[^>]*>(.*)<\\/a>/iU"
"$1"
,$comment
);
}