Title: accessing post data  with hooks
Last modified: August 18, 2016

---

# accessing post data with hooks

 *  Resolved [themarco](https://wordpress.org/support/users/themarco/)
 * (@themarco)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/accessing-post-data-with-hooks/)
 * Ok this may sound like a complicated question. I do hope however that someone
   will be able to answer it. What I need to do is the following:
    - When saving a NEW post I need access to the content and the ID of that post
      right AFTER posting it.
    - When editing a post I need access to the content and ID of that post right
      AFTER editing it.
    - When deleting a post I need access to the content and the ID of that post 
      right BEFORE deleting it.
 * Can someone tell me which plugin action hooks to use and which (global) variables
   will contain the data I need?
 * I assume I need to use:
 * add_action(‘publish_post’, ‘function’);
    add_action(‘delete_post’, ‘other_function’);
 * However I have no clue how to access the data I want to access as described above
   in function() and other_function().
 * Can anyone tell me?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [themarco](https://wordpress.org/support/users/themarco/)
 * (@themarco)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/accessing-post-data-with-hooks/#post-264731)
 * Nevermind. got it figured out!
 *  [interrupt](https://wordpress.org/support/users/interrupt/)
 * (@interrupt)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/accessing-post-data-with-hooks/#post-264924)
 * so, Now I am in that situation, can you explain the way to do this?
 *  [interrupt](https://wordpress.org/support/users/interrupt/)
 * (@interrupt)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/accessing-post-data-with-hooks/#post-264925)
 * yes! it happened to me too, now I figured it out!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘accessing post data with hooks’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [interrupt](https://wordpress.org/support/users/interrupt/)
 * Last activity: [19 years, 11 months ago](https://wordpress.org/support/topic/accessing-post-data-with-hooks/#post-264925)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
