From a1531d97af9943ff86c710d8d5e9903ff48c492b Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Wed, 12 Oct 2016 13:49:21 +0000 Subject: [PATCH] Comments: When checking comments, returned error object should include HTTP status code. The status code in the `WP_Error` `data` array is needed to send headers in wp-comments-post.php, and was erroneously not included in [38778]. Props needle, websupporter. Fixes #36901. git-svn-id: https://develop.svn.wordpress.org/trunk@38783 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index b260ee8643..36a277aeea 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -646,7 +646,7 @@ function wp_allow_comment( $commentdata, $avoid_die = false ) { */ do_action( 'comment_duplicate_trigger', $commentdata ); if ( true === $avoid_die ) { - return new WP_Error( 'comment_duplicate', __( 'Duplicate comment detected; it looks as though you’ve already said that!' ), $dupe_id ); + return new WP_Error( 'comment_duplicate', __( 'Duplicate comment detected; it looks as though you’ve already said that!' ), 409 ); } else { if ( wp_doing_ajax() ) { die( __('Duplicate comment detected; it looks as though you’ve already said that!') ); @@ -702,7 +702,7 @@ function wp_allow_comment( $commentdata, $avoid_die = false ) { ); if ( $is_flood ) { - return new WP_Error( 'comment_flood', __( 'You are posting comments too quickly. Slow down.' ) ); + return new WP_Error( 'comment_flood', __( 'You are posting comments too quickly. Slow down.' ), 429 ); } if ( ! empty( $commentdata['user_id'] ) ) {