[wp-trac] [WordPress Trac] #36302: wp_update_comment needs a filter
WordPress Trac
noreply at wordpress.org
Wed Apr 27 17:30:01 UTC 2016
#36302: wp_update_comment needs a filter
-------------------------+------------------------------
Reporter: frankiet | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 4.4.2
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
-------------------------+------------------------------
Comment (by boonebgorges):
> Would the location I suggested, at the array merge work better?
@dshanske It's better, but not ideal, because then it's impossible to
override any of the 'comment_approved' logic, 'comment_date_gmt', the
filtered `$commentarr`, or the results of 'comment_save_pre'. The best
place for this kind of filter is right before the `$rval` line. But some
juggling may need to be done with `wp_slash()` and `wp_unslash()`, to make
sure that content (especially the 'comment_content') is unslashed properly
before it gets into the DB; alternatively, you could write in the
documentation that the data being passed to the filter is already
unslashed.
As a side note, is there a reason why the individual filters applied in
`wp_filter_comment()` won't work? Why are we introducing a single filter
on the whole array, when each value is already filtered separately? What
value is the `'filtered'` flag that's set in `wp_filter_comment()` if we
are applying an overriding filter elsewhere?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36302#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list