WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] accessing post data with hooks (4 posts)

  1. TheMarco
    Member
    Posted 8 years ago #

    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?

  2. TheMarco
    Member
    Posted 8 years ago #

    Nevermind. got it figured out!

  3. interrupt
    Member
    Posted 7 years ago #

    so, Now I am in that situation, can you explain the way to do this?

  4. interrupt
    Member
    Posted 7 years ago #

    yes! it happened to me too, now I figured it out!

Topic Closed

This topic has been closed to new replies.

About this Topic