[wp-hackers] Write a custom field to a new post via JS??

scribu scribu at gmail.com
Tue Jan 5 23:12:42 UTC 2010


New posts are assigned a temporary id. See how it's used in the
wp_write_post() function:

http://xref.yoast.com/trunk/nav.html?wp-admin/includes/post.php.source.html#l439

Hope that helps.


On Tue, Jan 5, 2010 at 11:32 PM, Matthew Gerring <mgerring at emrl.com> wrote:

> Hello all. I have a serious brain twister I hope you all can help me solve.
>
> I have an interface in the WordPress "add new post" screen, accessed via
> the media buttons. Basically what it's supposed to do is write an array to a
> custom field.
>
> It works fine if you're editing a post- I can pass the array to PHP along
> with the post ID and use add_post_meta(). But I don't know how to do the
> same thing if you're creating a new post, since there's no post ID to add a
> custom field to.
>
> Can anyone tell me how I would write metadata to a post that hasn't been
> published yet?
>
> -Matthew
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
http://scribu.net


More information about the wp-hackers mailing list