Add JS when post is published
-
Hi,
I am trying to add javascript when a post has been published so that it’s more noticable for my user but I can’t figure out what to use.
I tryed with publish_post and save_post, but it doesn’t work unless I put die; at the end of the code.
I’ve tryed so hard to stay out of the wordpress core code, and I really don’t want to have to because of this problem…
here’s my code :function run_when_post_published($post_ID){ echo '<script type="text/javascript"> alert("essai"); </script>'; } add_action('publish_slider', 'run_when_post_published');
Thanks for your help !
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add JS when post is published’ is closed to new replies.