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.
Built from https://develop.svn.wordpress.org/trunk@38783


git-svn-id: http://core.svn.wordpress.org/trunk@38726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2016-10-12 13:50:30 +00:00
parent 5f5c85c510
commit 9935b60e72
2 changed files with 3 additions and 3 deletions

View File

@ -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'] ) ) {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38782';
$wp_version = '4.7-alpha-38783';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.