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
1189
1190      /**
1191       * Fires immediately before changing the comment's status to 'delete'.
1192       *
1193       * @since 1.5.0
1194       *
1195       * @param int    $comment_id The comment ID.
1196       * @param string $status     The new 'delete' comment status.
1197       */
1198      do_action( 'wp_set_comment_status', $comment_id, 'delete' );
1199      wp_transition_comment_status('delete', $comment->comment_approved, $comment);
1200      return true;
1201 }
1202
1203 /**
1204  * Moves a comment to the Trash
1205  *
1206  * If trash is disabled, comment is permanently deleted.
1207  *
 
Line Code
1781       *
1782       * The hook also fires immediately before comment status transition hooks are fired.
1783       *
1784       * @since 1.5.0
1785       *
1786       * @param int         $comment_id     The comment ID.
1787       * @param string|bool $comment_status The comment status. Possible values include 'hold',
1788       *                                    'approve', 'spam', 'trash', or false.
1789       */
1790      do_action( 'wp_set_comment_status', $comment_id, $comment_status );
1791      wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment);
1792
1793      wp_update_comment_count($comment->comment_post_ID);
1794
1795      return true;
1796 }
1797
1798 /**
1799  * Updates an existing comment in the database.