Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_set_comment_status

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
1199
1200      /**
1201       * Fires immediately before changing the comment's status to 'delete'.
1202       *
1203       * @since 1.5.0
1204       *
1205       * @param int    $comment_id The comment ID.
1206       * @param string $status     The new 'delete' comment status.
1207       */
1208      do_action( 'wp_set_comment_status', $comment_id, 'delete' );
1209      wp_transition_comment_status('delete', $comment->comment_approved, $comment);
1210      return true;
1211 }
1212
1213 /**
1214  * Moves a comment to the Trash
1215  *
1216  * If trash is disabled, comment is permanently deleted.
1217  *
 
Line Code
1798       *
1799       * The hook also fires immediately before comment status transition hooks are fired.
1800       *
1801       * @since 1.5.0
1802       *
1803       * @param int         $comment_id     The comment ID.
1804       * @param string|bool $comment_status The comment status. Possible values include 'hold',
1805       *                                    'approve', 'spam', 'trash', or false.
1806       */
1807      do_action( 'wp_set_comment_status', $comment_id, $comment_status );
1808      wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment);
1809
1810      wp_update_comment_count($comment->comment_post_ID);
1811
1812      return true;
1813 }
1814
1815 /**
1816  * Updates an existing comment in the database.