save_post not working getting called….
-
To do some experiment with save_post hook, i wrote following bare minimum code. But looks like it is not getting called consistently.
I am just echoing html comment in the call back. So after GUI action if we do view source i should see my comment.
I see my comment being printed on when I try “new post”. If publish post and then do view source I do NOT see my html comment.
Any idea why my call back is not getting called consistently?
<?php
/*
Plugin Name: Save Post
Plugin URI: https://www.ads-software.com/
Description: Save Post Example.
Author: www.ads-software.com
Version: 1.0
Author URI: https://www.ads-software.com/
*//* Do something with the data entered */
add_action(‘save_post’, ‘myplugin_save_postdata’);/* When the post is saved, saves our custom data */
function myplugin_save_postdata( $post_id ) {
echo “<!—————— Test Comment —————>”;
return $post_id;
}?>
- The topic ‘save_post not working getting called….’ is closed to new replies.