Weird add_action wp_insert_post
-
Hi,
I’m using a template that uses the wp_insert_post() function to publish posts from outside the WordPress administrator. Now I’m creating a plugin to send an email to users when a new post is published (actually users who belong to a specific usergroup). From what I understand, I should use the wp_insert_post action hook so the plugin runs everytime a new post is inserted with that function, but somehow it’s not working.
I’m using
add_action(‘wp_insert_post’,’function_name’);
at the beginning of the plugin but it does not work. No error. It’s just not being triggered.When I try
add_action(‘publish_post’,’function_name’);
and I publish a post from the WordPress administrator, plugin works fine and emails are sent. When using this, also plugin isn’t triggered from outside the administrator.Any idea on what could be wrong? Which action hook should I try too?
Thank you for your help.
- The topic ‘Weird add_action wp_insert_post’ is closed to new replies.