Title: comment_post not triggering?
Last modified: August 19, 2016

---

# comment_post not triggering?

 *  [SharkBait](https://wordpress.org/support/users/sharkbait/)
 * (@sharkbait)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/comment_post-not-triggering/)
 * I am writing a small plugin that needs to execute after someone has posted a 
   comment and I don’t think it is triggering properly.
 * Is there an easy way to test it?
 *     ```
       function myfunction($comment_ID) {
         update_option('test_respsonse', 'This should be saved');
       }
       add_action('comment_post', 'myfunction');
       ```
   
 * Technically shouldn’t myfunction() get executed when someone submits a comment?
 * On the admin page for the plugin I have something to this effect:
    `echo "Repsonse:".
   get_option('test_response');`
 * But it does not show any changes so I am assuming my add_action() hook isn’t 
   executing properly.
 * What am I doing wrong?

Viewing 1 replies (of 1 total)

 *  [djay77](https://wordpress.org/support/users/djay77/)
 * (@djay77)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/comment_post-not-triggering/#post-838637)
 * Hi,
 * I have exactly the same problem.
    The add_action(‘comment_post’) didn’t work
 * A very simple and visible example
 *     ```
       add_action('comment_post ', 'toto');
       function toto()
       {
           die('djay');
       }
       ```
   
 * Nothing happened 🙁
 * /////
    Forget what i said, i putted a space in add_action(‘comment_post ‘) 😀

Viewing 1 replies (of 1 total)

The topic ‘comment_post not triggering?’ is closed to new replies.

## Tags

 * [add_action](https://wordpress.org/support/topic-tag/add_action/)
 * [comment_post](https://wordpress.org/support/topic-tag/comment_post/)
 * [hook](https://wordpress.org/support/topic-tag/hook/)

 * 1 reply
 * 2 participants
 * Last reply from: [djay77](https://wordpress.org/support/users/djay77/)
 * Last activity: [17 years, 4 months ago](https://wordpress.org/support/topic/comment_post-not-triggering/#post-838637)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
