mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
AJAX: add a new function, wp_doing_ajax(), which can replace... (wait for it...) DOING_AJAX checks via the constant.
Props Mte90, sebastian.pisula, swissspidy. Fixes #25669. git-svn-id: https://develop.svn.wordpress.org/trunk@38334 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -632,7 +632,7 @@ function wp_allow_comment( $commentdata ) {
|
||||
* @param array $commentdata Comment data.
|
||||
*/
|
||||
do_action( 'comment_duplicate_trigger', $commentdata );
|
||||
if ( defined( 'DOING_AJAX' ) ) {
|
||||
if ( wp_doing_ajax() ) {
|
||||
die( __('Duplicate comment detected; it looks as though you’ve already said that!') );
|
||||
}
|
||||
wp_die( __( 'Duplicate comment detected; it looks as though you’ve already said that!' ), 409 );
|
||||
@@ -768,7 +768,7 @@ function check_comment_flood_db( $ip, $email, $date ) {
|
||||
*/
|
||||
do_action( 'comment_flood_trigger', $time_lastcomment, $time_newcomment );
|
||||
|
||||
if ( defined('DOING_AJAX') )
|
||||
if ( wp_doing_ajax() )
|
||||
die( __('You are posting comments too quickly. Slow down.') );
|
||||
|
||||
wp_die( __( 'You are posting comments too quickly. Slow down.' ), 429 );
|
||||
|
||||
Reference in New Issue
Block a user