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 :

  1. which api action / filter me achieve above problem statement ?

  2. is best use actions or filters ?

  3. how identify whether action registered ?

  4. 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

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -