WordPress.org

Make WordPress Core

Changeset 38783


Ignore:
Timestamp:
10/12/16 13:49:21 (8 months ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r38778 r38783  
    647647        do_action( 'comment_duplicate_trigger', $commentdata ); 
    648648        if ( true === $avoid_die ) { 
    649             return new WP_Error( 'comment_duplicate', __( 'Duplicate comment detected; it looks as though you’ve already said that!' ), $dupe_id ); 
     649            return new WP_Error( 'comment_duplicate', __( 'Duplicate comment detected; it looks as though you’ve already said that!' ), 409 ); 
    650650        } else { 
    651651            if ( wp_doing_ajax() ) { 
     
    703703 
    704704    if ( $is_flood ) { 
    705         return new WP_Error( 'comment_flood', __( 'You are posting comments too quickly. Slow down.' ) ); 
     705        return new WP_Error( 'comment_flood', __( 'You are posting comments too quickly. Slow down.' ), 429 ); 
    706706    } 
    707707 
Note: See TracChangeset for help on using the changeset viewer.