wp_throttle_comment_flood()评论数量异常增多时,该函数决定是否禁止评论

目录

描述

Determine whether comment should be blocked because of comment flood.

wp_throttle_comment_flood() 描述

用法

<?php wp_throttle_comment_flood$block$time_lastcomment$time_newcomment ?>

wp_throttle_comment_flood() 用法

参数

$block

(boolean) (必填) True if plugin is blocking comments.

默认值: None

$time_lastcomment

(integer) (必填) Timestamp for last comment.

默认值: None

$time_newcomment

(integer) (必填) Timestamp for new comment.

默认值: None

wp_throttle_comment_flood() 参数

返回值

(boolean) 

Returns true if $block is true or if $block is false and $time_newcomment - $time_lastcomment < 15. Returns false otherwise.

wp_throttle_comment_flood() 返回值

历史

添加于 版本: 2.1.0

wp_throttle_comment_flood() 历史

源文件

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

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Whether a comment should be blocked because of comment flood.
 *
 * @since 2.1.0
 *
 * @param bool $block Whether plugin has already blocked comment.
 * @param int $time_lastcomment Timestamp for last comment.
 * @param int $time_newcomment Timestamp for new comment.
 * @return bool Whether comment should be blocked.
 */
function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) {
	if ( $block ) // a plugin has already blocked... we'll let that decision stand
		return $block;
	if ( ($time_newcomment - $time_lastcomment) < 15="" )="" return="" true;="" return="" false;="" }="">

wp_throttle_comment_flood() 源文件

相关