-if ( empty($status->comment_status) ) {
- do_action('comment_id_not_found', $comment_post_ID);
+$status_obj = get_post_status_object($status);
+
+if ( ! comments_open( $comment_post_ID ) ) {
+ /**
+ * Fires when a comment is attempted on a post that has comments closed.
+ *
+ * @since 1.5.0
+ *
+ * @param int $comment_post_ID Post ID.
+ */
+ do_action( 'comment_closed', $comment_post_ID );
+ wp_die( __( 'Sorry, comments are closed for this item.' ), 403 );
+} elseif ( 'trash' == $status ) {
+ /**
+ * Fires when a comment is attempted on a trashed post.
+ *
+ * @since 2.9.0
+ *
+ * @param int $comment_post_ID Post ID.
+ */
+ do_action( 'comment_on_trash', $comment_post_ID );
+ exit;
+} elseif ( ! $status_obj->public && ! $status_obj->private ) {
+ /**
+ * Fires when a comment is attempted on a post in draft mode.
+ *
+ * @since 1.5.1
+ *
+ * @param int $comment_post_ID Post ID.
+ */
+ do_action( 'comment_on_draft', $comment_post_ID );