欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來(lái)到入門(mén)教程網(wǎng)!

WordPress

當(dāng)前位置:主頁(yè) > CMS教程 > WordPress >

WordPress評(píng)論中禁止HTML代碼顯示的方法

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-11|欄目:WordPress|點(diǎn)擊: 次

本文實(shí)例講述了WordPress評(píng)論中禁止HTML代碼顯示的方法。分享給大家供大家參考。具體分析如下:

使用WordPress的朋友會(huì)發(fā)現(xiàn)如果我們開(kāi)戶(hù)了博客評(píng)論會(huì)經(jīng)??吹酱罅康睦鴱V告,帶連接了,那么我們要如何禁止用戶(hù)輸入html標(biāo)簽原樣輸出,而不顯示呢,下面我來(lái)給大家介紹.

html標(biāo)題無(wú)非就是由“<”、“>”組成了,我們可以反它轉(zhuǎn)換成“&lt;”、“&gt;”,這樣通過(guò)HTML編譯,自動(dòng)變成了“<”、“>” 我們也可以直接替換掉了

找到一國(guó)外人的代碼,搞定了,不過(guò)不一定他是原作者,在functions.php的PHP代碼里加入如下代碼:

復(fù)制代碼
代碼如下:
//禁用wordpress評(píng)論html代碼
// This will occur when the comment is posted
function plc_comment_post( $incoming_comment ) {
// convert everything in a comment to display literally
$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);
// the one exception is single quotes, which cannot be #039; because WordPress marks it as spam
$incoming_comment['comment_content'] = str_replace( "'", '&apos;', $incoming_comment['comment_content'] );
return( $incoming_comment );
}
// This will occur before a comment is displayed
function plc_comment_display( $comment_to_display ) {
// Put the single quotes back in
$comment_to_display = str_replace( '&apos;', "'", $comment_to_display );
return $comment_to_display;
}
add_filter( 'preprocess_comment', 'plc_comment_post', '', 1);
add_filter( 'comment_text', 'plc_comment_display', '', 1);
add_filter( 'comment_text_rss', 'plc_comment_display', '', 1);
add_filter( 'comment_excerpt', 'plc_comment_display', '', 1);

希望本文所述對(duì)大家的WordPress建站有所幫助。

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有