wordpressでコメント欄で使用できるタグを追加する
wordpressでコメント欄で使用できるタグを追加する
方法について備忘録です。
テーマのfunction.phpに下記を追加します。
/*-------------------------------------------*/ /* Comment tag add /*-------------------------------------------*/ add_filter('comments_open','allow_tags_in_comments'); add_filter('pre_comment_approved','allow_tags_in_comments'); function allow_tags_in_comments($data) { global $allowedtags; $allowedtags['img'] = array('src'=>array()); $allowedtags['br'] = array(); return $data; }
brとimgを追加できるようにしてみた例です。
スクレイピングで2chから取得した内容をブログのコメント欄へ投稿する際に試行錯誤しました。
Total 23 views