[wp-trac] [WordPress Trac] #36901: Removing wp_die() from wp_allow_comment()
WordPress Trac
noreply at wordpress.org
Sat May 21 19:04:28 UTC 2016
#36901: Removing wp_die() from wp_allow_comment()
--------------------------+-----------------------------
Reporter: websupporter | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Ticket #34059 introduced `wp_handle_comment_post()` to abstract the whole
process of comment submission "in order to make the actual process of
submitting a comment unit testable."
I want to propose, to extend this a bit more and to remove the `wp_die()`
functionality, when it comes to duplicate comments and comment flood.
Instead of `wp_die()`, we should return WP_Error objects, indicating a
comment is duplicate or is considered comment flood. These error objects
would travel upwards until they are handeled in `wp-comments-post.php`.
The advantage of this would be, we could use `wp_allow_comment()` to check
a comment for duplicate and flood. This could be utilized in the REST API,
where we could in case of a flood or a duplicate return a valid JSON-
String instead of the `wp_die()`-HTML.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36901>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list