1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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