[wp-trac] [WordPress Trac] #39730: Checking if wp_new_comment() return value is a WP_Error
WordPress Trac
noreply at wordpress.org
Wed Jun 28 13:31:59 UTC 2017
#39730: Checking if wp_new_comment() return value is a WP_Error
-------------------------------+--------------------
Reporter: enrico.sorcinelli | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.8.1
Component: Comments | Version: 4.8
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------------+--------------------
Comment (by enrico.sorcinelli):
I updated the patch also by documenting that by returning `WP_Error` from
`pre_comments_approved` filter will shortcircuit the insertion and allow
skipping further processing. This new little enhancement offers to the
user the chance to skip comment insertion based on a custom criteria after
the core checks.
Additional instruction about how to reproduce the error on the current
trunk:
1. Add a filter like following:
{{{#!php
<?php
function wp_is_comment_flood_filter () {
return true;
}
add_filter ( 'wp_is_comment_flood', 'wp_is_comment_flood_filter', 10 );
}}}
2. Go to an edit post admin page
3. Add a new not-empty comment
A new one empty comment will appear on comment list below with anonymous
user, unresolved avatar and with not working links (since they don't have
comment id).
Anyway the new comments hasn't not been inserted on the database and by
reloading page will clean anonymous comments.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39730#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list