Skip to content

WP_Error causes HTTP status code 500 when comment form ReCaptcha is not valid #87

@l3ku

Description

@l3ku

When having the setting "Forms to protect" => "Comment Form" applied and sending a blog post comment without ReCaptcha checked, returning a WP_Error from the function recaptcha_check_or_die added as a hook to pre_comment_on_post on https://github.com/mcguffin/wp-recaptcha-integration/blob/9d669d6b62b0306d08ef98e8a69f4af538ebcfe2/inc/class-wp_recaptcha.php#L152 causes the POST request towp-comments-post.php to return a HTTP 500 status code. As HTTP 500 status codes typically means "Internal Server Error", this is logged to my current testing/monitoring mechanism as an error in my website code. I think that a HTTP status 4xx would better represent the actual case happening here, as the ReCaptcha plugin functionality is functioning just as intended: that is, not letting the user submit the comment without ReCaptcha.

Is there any way to disable the HTTP Status 500 via WP Admin options or adding plugin provided filters/hooks to my website theme?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions