[wp-trac] [WordPress Trac] #36302: wp_update_comment needs a filter
WordPress Trac
noreply at wordpress.org
Wed Apr 27 19:11:38 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 dshanske):
That may be the best point...but it was more a companion to
preprocess_comment. You can't add preprocess comment to edit_comment at
this point, because of backcompat. It is specifically if you want to run
something only on update, but not on new.
Replying to [comment:7 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:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list