[wp-trac] [WordPress Trac] #57106: Allowing comment form error pages
WordPress Trac
noreply at wordpress.org
Mon Nov 14 15:21:43 UTC 2022
#57106: Allowing comment form error pages
-------------------------+------------------------------
Reporter: apermo | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+------------------------------
Changes (by apermo):
* keywords: => has-patch
Comment:
The Patch above adds the following lines to `wp-comments-posts.php`.
{{{#!php
<?php
/**
* Fires after an comment submission ended in a WP_Error.
*
* Use this for logging purposes, or for forwarding to alternative
direction rather than showing a wp_die.
*
* @since TBD
*
* @param WP_Error $comment The error object thrown by
wp_handle_comment_submission
*/
do_action( 'comment_submission_is_error', $comment );
}}}
This would be everything needed for a theme developer (or the WordPress
core itself) to provide a different mean for handling comment submission
errors.
Optionally we could add a second and maybe third parameter, but that would
just be $_POST and $_SERVER['HTTP_REFERER'] in the end, but those might
provide benefits for automated testings.
By hooking a redirect to the referrer URL including an anchor and a
parameter onto that action, I could perfectly display anything I want.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57106#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list