diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index aef6209..d1dc117 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -2018,9 +2018,11 @@ function comment_unpublish_action(Comment $comment = NULL, $context = array()) {
  * @see comment_unpublish_by_keyword_action_submit()
  */
 function comment_unpublish_by_keyword_action(Comment $comment, $context) {
+  $node = node_load($comment->nid);
+  $build = comment_view($comment, $node);
+  $text = drupal_render($build);
   foreach ($context['keywords'] as $keyword) {
-    $text = drupal_render($comment);
-    if (strpos($text, $keyword) !== FALSE) {
+    if (strpos($text, $keyword) !== FALSE || (!empty($comment->subject) && strpos($comment->subject, $keyword) !== FALSE)) {
       $comment->status = COMMENT_NOT_PUBLISHED;
       watchdog('action', 'Unpublished comment %subject.', array('%subject' => $comment->subject));
       break;
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php
index 8f802c1..6ee843f 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentActionsTest.php
@@ -24,7 +24,8 @@ class CommentActionsTest extends CommentTestBase {
    */
   function testCommentPublishUnpublishActions() {
     $this->drupalLogin($this->web_user);
-    $comment_text = $this->randomName();
+    $keyword = 'keyword';
+    $comment_text = $keyword . ' ' . $this->randomName();
     $subject = $this->randomName();
     $comment = $this->postComment($this->node, $comment_text, $subject);
     $comment = comment_load($comment->id);
@@ -51,6 +52,13 @@ class CommentActionsTest extends CommentTestBase {
     $this->assertEqual(comment_load($comment->cid)->status, COMMENT_PUBLISHED, t('Comment was published'));
     $this->assertWatchdogMessage('Published comment %subject.', array('%subject' => $subject), t('Found watchdog message'));
     $this->clearWatchdog();
+    
+    // Unpublish a comment by keyword (direct form: modify the comment in the database).
+    $context = array('keywords' => array($keyword));
+    comment_unpublish_by_keyword_action($comment, $context);
+    $this->assertEqual($comment->status, COMMENT_NOT_PUBLISHED, t('Comment was unpublished'));
+    $this->assertWatchdogMessage('Unpublished comment %subject.', array('%subject' => $subject), t('Found watchdog message'));
+    $this->clearWatchdog();
   }
 
   /**
