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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

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
963           return false;
964      do_action('deleted_comment', $comment_id);
965
966      $post_id = $comment->comment_post_ID;
967      if ( $post_id && $comment->comment_approved == 1 )
968           wp_update_comment_count($post_id);
969
970      clean_comment_cache($comment_id);
971
972      do_action('wp_set_comment_status', $comment_id, 'delete');
973      wp_transition_comment_status('delete', $comment->comment_approved, $comment);
974      return true;
975 }
976
977 /**
978  * Moves a comment to the Trash
979  *
980  * If trash is disabled, comment is permanently deleted.
981  *
 
Line Code
1401                return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error);
1402           else
1403                return false;
1404      }
1405
1406      clean_comment_cache($comment_id);
1407
1408      $comment = get_comment($comment_id);
1409
1410      do_action('wp_set_comment_status', $comment_id, $comment_status);
1411      wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment);
1412
1413      wp_update_comment_count($comment->comment_post_ID);
1414
1415      return true;
1416 }
1417
1418 /**
1419  * Updates an existing comment in the database.