Opened 2 years ago
Last modified 2 years ago
#57106 new enhancement
Allowing comment form error pages
Reported by: | apermo | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | has-patch |
Focuses: | Cc: |
Description
Current status quo:
As of now, it is not possible to have customized a customized validation for forms (covered in #57105 )
And every single error will either end in a wp_die() or an exit.
Proposal:
Instead of always ending in wp_die()
we could forward to the referer page, including the error_message and the $_POST data, to prefill the form (especially with the comment, since these would be really painful if lost).
comment_form()
would require an enhancement to show errors.
This idea is still in progress, I'll provide a working proof of concept later, but I wanted to open this for discussion.
Note: Will also need some kind of representation for the Rest API.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
The Patch above adds the following lines to
wp-comments-posts.php
.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 $_SERVERHTTP_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.