[wp-hackers] Post ID and New Post Problem
Dion Hulse (dd32)
wordpress at dd32.id.au
Fri Jul 13 01:19:55 UTC 2012
It does exactly what you want.
wp_insert_post() returns the $post_id of the created post, you can
then add meta to it. This is how every plugin operates, if it doesn't
work for you, you've probably got a bug in your code elsewhere.
On 13 July 2012 11:04, Sinan <sinan at sinanisler.com> wrote:
> Thanks Rafael,
>
> But this is not what I seek.
>
> And this code not work :) for 2 step maybe but 1 step adding post and meta
> fields this code not works.
>
> I think a way for solution but I'm looking better solution. My solution is;
>
> As you know when we write a post-page wordpress panel page automatic save
> the draft post and create a post id for that. Any way this is the wordpress
> wp-admin way :)
>
> We need new way. If there is it...
>
>
>
>
> 2012/7/13 Rafael Ehlers <rafaehlers at gmail.com>
>
>> http://pastebin.com/rWjzJCHW
>>
>> On Thu, Jul 12, 2012 at 7:16 PM, Sinan <sinan at sinanisler.com> wrote:
>>
>> > Hello,
>> >
>> > As you know with wp_insert_post() function we can add new posts
>> >
>> > we cant add custom field because add_post_meta() function need Post ID
>> >
>> > But our problem start here with wp_insert_post function creating new post
>> > we dont have a Post ID
>> >
>> > so we cant add same time new post and custom field values. We can use
>> only
>> > add_post_meta function for existed posts.
>> >
>> > I need a solution for this. I need create post and add custom fields same
>> > time.
>> >
>> > By the way I see same problem for attachments.
>> >
>> >
>> > I hope we can find a solution for this.
>> >
>> >
>> > --
>> > Sinan İŞLER
>> > sinanisler.com <http://www.sinanisler.com>
>> > fb.com/sinanisler
>> > _______________________________________________
>> > wp-hackers mailing list
>> > wp-hackers at lists.automattic.com
>> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>> >
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> Sinan İŞLER
> sinanisler.com <http://www.sinanisler.com>
> fb.com/sinanisler
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list