Wordpress plugin to do something on post publish -
i new wordpress. writing custom plugin take post title post url , post content of newly published post , store in other store in background. using "publish_post" action same. however, don't think gets invoked.
i have few queries around :
which api action / filter me achieve above problem statement ?
is best use actions or filters ?
how identify whether action registered ?
how identify if action invoked ? tried putting echo statement not seem display. on "publish" click, icon next button keeps going round denote publish in progress. confused.
kindly help. !
you can add save_post
hook:
add_action( 'save_post', 'save'); function save( $id ){ if( get_post_status( $id ) == 'publish' ) { } }
for action vs filter question: these not can interchange; different beasts. think way: filter can alter value (so need return
value), action can't.
Comments
Post a Comment