check_comment()判断一个评论是否符合有效

目录

描述

译文

check_comment()判断评论是否传递WordPress Comment_Moderation 的内部检验。

原文

check_comment() checks whether a comment passes internal checks set by WordPress Comment_Moderation.

check_comment() 描述

用法

<?php
   check_comment
$author$email$url$comment$user_ip,
         
$user_agent$comment_type );
?>

check_comment() 用法

参数

$author

(string) (必填) Comment author name.

默认值: None

$email

(string) (必填) Comment author email.

默认值: None

$url

(string) (必填) Comment author URL.

默认值: None

$comment

(string) (必填) Comment contents.

默认值: None

$user_ip

(string) (必填) Comment author IP address.

默认值: None

$user_agent

(string) (必填) Comment author user agent.

默认值: None

$comment_type

(string) (必填) Comment type (comment, trackback, or pingback).

默认值: None

check_comment() 参数

返回值

(boolean) 

This function returns a single boolean value of either true or false.

Returns false if in Comment_Moderation:

  • The Administrator must approve all messages,
  • The number of external links is too high, or
  • Any banned word, name, URL, e-mail, or IP is found in any parameter except $comment_type.

Returns true if the Administrator does not have to approve all messages and:

  • $comment_type parameter is a trackback or pingback and part of the blogroll, or
  • $author and $email parameters have been approved previously.

Returns true in all other cases.

check_comment() 返回值

示例

Simple use case

check_comment() 示例

注意

check_comment() 注意

历史

  • 添加于 版本: WordPress Version 1.2

check_comment() 历史

源文件

check_comment() 函数的代码位于 wp-includes/comment.php.

check_comment() 源文件