add_action( 'transition_post_status', 'whatever', 10, 3 ); function whatever( $new, $old, $post ) { // compare $new and $old and act accordingly }
Basically, when $new is publish and $old is anything else, then you know a post is getting published for the first time. Or whatever your own criteria are. You can also examine $post to check for other things, like post_type or something. If it doesn't fit your criteria, just return without doing anything.
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
0 comments :: comparision of old and new post
Post a Comment