wp_throttle_comment_flood

Whether a comment should be blocked because of comment flood.

Description

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

Parameters (3)

0. $block (bool)
Whether plugin has already blocked comment.
1. $time_lastcomment (int)
Timestamp for last comment.
2. $time_newcomment (int)
Timestamp for new comment.

Usage

  1. if ( !function_exists( 'wp_throttle_comment_flood' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment.php'; 
  3.  
  4. // Whether plugin has already blocked comment. 
  5. $block = true; 
  6.  
  7. // Timestamp for last comment. 
  8. $time_lastcomment = -1; 
  9.  
  10. // Timestamp for new comment. 
  11. $time_newcomment = -1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/comment.php  
  1. function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) { 
  2. if ( $block ) // a plugin has already blocked... we'll let that decision stand 
  3. return $block; 
  4. if ( ($time_newcomment - $time_lastcomment) < 15 ) 
  5. return true; 
  6. return false;