امروز یکی از مهمترین و پرکاربردترین هک های وردپرس رو بهتون آموزش میدیم.
با وارد کردن این کد مخفی شما قادر خواهید بود تا تمام کد های HTML که اسپمر ها در بخش نظرات و بعنوان نظر قرار می دهند غیر فعال کنید. اغلب این کد ها اساساً لینک هستند، به کمک این هک دیگر این کدها هیچ عملکردی نخواهند داشت.
برای فعال کردن این هک، کد زیر را در functions.php وارد کنید
کد:
/ 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( "'", ''', $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( ''', "'", $comment_to_display );
return $comment_to_display;