Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#51481 closed defect (bug) (fixed)

Inline doc for `wp_set_comment_status` hook is wrong

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

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 6 years ago.
Updated docs

Download all attachments as: .zip

Change History (7)

#1 @davidbaumwald
6 years ago

  • Focuses docs added
  • Versiontrunk

#2 @SergeyBiryukov
6 years 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
6 years ago

  • Owner set to davidbaumwald
  • Priority normallow
  • Status newaccepted

@davidbaumwald
6 years ago

Updated docs

#4 @davidbaumwald
6 years ago

  • Keywords has-patch added; needs-patch removed

#5 @SergeyBiryukov
6 years ago

  • Milestone Awaiting Review5.6

#6 @SergeyBiryukov
6 years ago

  • Resolutionfixed
  • Status acceptedclosed

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.