Codex tools: Log in
Contents |
check_comment() checks whether a comment passes internal checks set by WordPress Comment_Moderation.
<?php check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, $comment_type ) ?>
Returns false if in Comment_Moderation:
Returns true if the Administrator does not have to approve all messages and:
Returns true in all other cases.
Simple use case
<?php $author = "Charles Montgomery Burns"; $email = "cmontgomery@springfieldnuclearpowerplant.com"; $url = "http://springfieldnuclearpowerplant.com"; $comment = "Excellent..."; $user_ip = "44.23.44.127"; $user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11"; $comment_type = "comment"; if (check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, $comment_type )) { echo "The Comment robot says: Thank you for your comment."; } else { echo "The Comment robot says: This comment is NOT valid!"; } ?>
check_comment() is located in wp-includes/comment.php.