wordpress – call a function when a comment is posted

I would like to take some action in php whenever someone posts a comment. How can I set up a hook for that? I assume it would go in functions.php…

EDIT – here is my udpated code:

add_action('comment_post', 'comment_posted');


    function comment_posted() {
        $MyClass = new MyClass(); //I do this in other functions and don't have any blank screen problems
            $test = "";
            $MyClass->doSomething($test); 
    }

Related posts

Leave a Reply

1 comment