Yazeka
Arama sonuçlarına göre oluşturuldu
WordPress'te
check_commentfonksiyonu, bir yorumun eklenmesine izin verilmesi için gerekli iç kontrollerden geçip geçmediğini kontrol etmek için kullanılır 234.
Kullanım şekli:
$is_valid = check_comment( $comment_content );
Bu fonksiyon, bir yorum içeriği dizisini parametre olarak alır ve yorumun geçerli olup olmadığını belirten bir boolean değeri döndürür 2.
Kullanım örnekleri:
- Temel kullanım:
$comment_data = array( 'comment_post_ID' => 1, 'comment_author' => 'John Doe', 'comment_author_email' => 'john@example.com', 'comment_content' => 'This is a sample comment.' ); if ( check_comment($comment_data) ) { // Yorum geçerli; daha fazla işleme devam et. }
- Yorum yazarını kontrol etme:
if ( isset( $_POST['comment_author'] ) && ! empty( $_POST['comment_author'] ) ) { $comment_data['comment_author'] = sanitize_text_field($_POST['comment_author']); } else { // Geçersiz yazar durumunu işle. }
5 kaynaktan alınan bilgiyle göre: