Forums
Home / Plugins / comment_post not triggering?
(@sharkbait)
15 years, 8 months ago
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');
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?
(@djay77)
15 years, 4 months ago
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 ‘) 😀
(@sharkbait)
15 years, 8 months ago
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?
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?