[wp-hackers] How find the correct post_id to save.

Otto otto at ottodestruct.com
Mon Dec 8 20:55:25 GMT 2008

On Mon, Dec 8, 2008 at 2:50 PM, Mikael Hedengren <mikael at cylinderlabs.se> wrote:
> I need to add update a separate database table when I write a post so I use
> add_action('save_post', ...) to get the data to save.
> The problem is that I get two calls with different postID:s when I save the
> post and I only want to create a database entry for the "real" (parent) post
> but I don't know how to find that out.
> Can anybody tell me how to get the correct postID or is there a better way
> to link to the correct post from my database table?

$post_id = (int) $_POST['post_ID'];

More information about the wp-hackers mailing list