wp_throttle_comment_flood() WordPress Function

The wp_throttle_comment_flood() function is used to check whether a comment flood is occurring. If too many comments are being made in a short period of time, this function will throttle the comments to prevent the flood.

wp_throttle_comment_flood( bool $block, int $time_lastcomment, int $time_newcomment ) #

Determines whether a comment should be blocked because of comment flood.


Parameters

$block

(bool)(Required)Whether plugin has already blocked comment.

$time_lastcomment

(int)(Required)Timestamp for last comment.

$time_newcomment

(int)(Required)Timestamp for new comment.


Top ↑

Return

(bool) Whether comment should be blocked.


Top ↑

Source

File: wp-includes/comment.php

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;
}

Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More