[wp-trac] [WordPress Trac] #62644: Editing comments as an admin, in the Admin UI, filters the HTML elements of the comment as though the edit was done by the original author.

WordPress Trac noreply at wordpress.org
Thu Dec 5 06:01:48 UTC 2024


#62644: Editing comments as an admin, in the Admin UI, filters the HTML elements of
the comment as though the edit was done by the original author.
--------------------------+------------------------------
 Reporter:  turbodb       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Comments      |     Version:  6.7.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by turbodb):

 Hi @yogeshbhutkar,

 Thanks for the quick response, and the workaround suggestions. A couple
 thoughts on your suggestions:

 1. I agree with your suggestion of using a plugin rather than
 functions.php, and in fact, that is what I'm doing. I was trying to
 provide the simplest repro steps in the bug report, and functions.php
 seemed a lighter weight repro than creating a plugin.

 2. I know that I can use {{{init}}}, but that's a much heavier weight
 (riskier / larger surface area) solution than the one I'm looking for (to
 your point about looking for a "safer" solution). There are two reasons it
 is heavy-handed:
   * it runs every single page load, rather than only when comments are in
 play.
   * it adds/allows <img> in all cases, opening up a larger surface area
 than allowing it only for the case (comments) for which I want it to be
 allowed.



 **And, a clarification:**

 You stated:

   ...using the {{{init}}} hook instead of {{{pre_comment_on_post}}}
 resolved the problem for me.

 To be clear - the {{{pre_comment_on_post}}} works perfectly when the
 comment is initially created, which is the only time I would expect it to
 run, since it is "**pre**" the **comment** being added **on** a **post**.

 The time when it doesn't run - and I was suggesting that another hook
 should exist for this case - is when a comment is being edited in the
 Admin UI. I'd expect a hook such as {{{pre_comment_edit}}} or something of
 that nature.

 **Net net:**
 It seems to me that if there is a hook for "before comment creation,"
 there should be a matching hook for "before comment edit," since,
 otherwise, there's no way to ensure that operations done during (and
 scoped to) creation are maintained during (and still scoped to) comment
 edits.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62644#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list