Wordpress: Getting the post ID in a plugin

Discussion in 'PHP' started by fireflyproject, Dec 18, 2008.

  1. #1
    Hey wordpressers,

    So I'm writing my first plugin and seem to have hit a wall.

    I would love to use the add_post_meta function to create meta for a new post. This function's first argument is the post_id though. Now, how can I get the post ID if the post has yet to be created?

    I have a section created underneath the content area, and I would like to process it via AJAX like the Custom Fields area, but without the Post ID, I'm stuck. How does the Custom Fields area get the post ID for a post that hasn't yet been created?
     
    fireflyproject, Dec 18, 2008 IP