Archived topic
Hook / action when I click on Publish
3 replies · Started by Jean-Pol on December 8, 2020
Hello,
I am new to wordpress hooks. I would like to accomplish something when I save on the publish button of an article. I can't find the hook to use which would trigger just when clicking on the button to save / save an article.
To test, I placed this code in function.php, but nothing appears:
function example($post_ID)
{
echo '<script language="javascript">';
echo 'alert(SAVED)';
echo '</script>';
}
add_action('publish_post', 'example');
I try many hook, like save_post, but no succes.
Hi there,
The theme itself doesn't deal with this side of things at all.
I would recommend checking with the WordPress support team to see if they are able to help, or start a topic in a general WordPress website like this:
https://wordpress.stackexchange.com/
Thanks for your understanding and hope this helps :)
Thanks Leo !
No problem :)