• 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)
  • 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.