WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 5 months ago

#51481 closed defect (bug) (fixed)

Inline doc for `wp_set_comment_status` hook is wrong

Reported by: henry.wright Owned by: davidbaumwald
Milestone: 5.6 Priority: low
Severity: normal Version: 5.6
Component: Comments Keywords: has-patch
Focuses: docs Cc:

Description

Taken from the wp_set_comment_status() function definition in comment.php

Fires immediately before transitioning a comment's status from one to another in the database.

This is wrong. The database update has already happened when the wp_set_comment_status hook is fired.

Attachments (1)

51481.diff (610 bytes) - added by davidbaumwald 5 months ago.
Updated docs

Download all attachments as: .zip

Change History (7)

#1 @davidbaumwald
5 months ago

  • Focuses docs added
  • Version set to trunk

#2 @SergeyBiryukov
5 months ago

  • Keywords needs-patch added

Thanks for the ticket!

Looking at the code, this appears to refer to wp_transition_comment_status() called immediately after.

However, wp_transition_comment_status() only calls the related hooks, the database update has indeed already occurred earlier at this point, so the comment should be corrected to clarify that.

#3 @davidbaumwald
5 months ago

  • Owner set to davidbaumwald
  • Priority changed from normal to low
  • Status changed from new to accepted

@davidbaumwald
5 months ago

Updated docs

#4 @davidbaumwald
5 months ago

  • Keywords has-patch added; needs-patch removed

#5 @SergeyBiryukov
5 months ago

  • Milestone changed from Awaiting Review to 5.6

#6 @SergeyBiryukov
5 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 49111:

Docs: Correct description for wp_set_comment_status hook.

The action fires immediately after transitioning a comment's status from one to another in the database and removing the comment from the object cache, but prior to all status transition hooks.

Props davidbaumwald, henry.wright.
Fixes #51481.

Note: See TracTickets for help on using tickets.