[wp-hackers] Set post thumbnail via code

Brad Williams bradw at illiams.com
Fri Mar 12 15:54:01 UTC 2010


Well that couldn't have been easier.  Thanks Glenn!

-Brad

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Glenn Ansley
Sent: Friday, March 12, 2010 10:42 AM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Set post thumbnail via code

Do you need something more than this:
update_post_meta( $post_id, '_thumbnail_id', $thumbnail_id );

I got that from /wp-admin/admin-ajax.php L1413 on trunk (several revisions
back though).

Glenn Ansley
http://fullthrottledevelopment.com
http://twitter.com/glennansley

On Fri, Mar 12, 2010 at 10:31 AM, Brad Williams <bradw at illiams.com> wrote:

> Is it possible to set a post thumbnail using code?  I've been digging
> through the Core process of setting a post thumbnail and it appears the
> WPSetAsThumbnail() function (located in set-post-thumbnail.js) is what
> actually creates/assigns the thumbnail, but I wasn't sure if this could be
> called directly?
>
>
>
> Has anyone tried this?
>
>
>
> -Brad
>
> @williamsba
>
>
>
>
>
> _______________________________________________
> 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




More information about the wp-hackers mailing list