[wp-hackers] Custom Post Types and Media Attachments

Becky Resler becky.absolute at gmail.com
Mon Dec 13 15:24:21 UTC 2010


My problem is not that the post_id isn't getting associated. The image
being uploaded *does* have the post_id associated with it. I've
confirmed by looking at the Media Library, and the image is associated
with the post of my custom post type.

There is obviously something else going on that is preventing the
image from being inserted into the WYSIWYG text area. I just need to
find the time to dig into the code of the media uploader to see what
criteria is looked at in order to show the *Insert into Post* button.

I just wanted to see if anyone knew if this was how things were
supposed to be or if it might possibly be a bug. Depending on what I
find after further research, I might submit a bug report.

Becky


On  Fri, 10 Dec 2010 17:43:13 -0500, Hal Burgiss <hal at burgiss.net> wrote:
>
> On Fri, Dec 10, 2010 at 10:31 AM, Becky Resler <becky.absolute at gmail.com>wrote:
>
> >
> > This screenshot shows what I get when I upload an image from the
> > *Products* meta box. As you can see, the *Insert into Post* button is
> > missing.
> >
> Not sure this is exactly the same issue, but a while back I ran into
> something similar, and it turned out the media-upload code was not getting
> the post_id value, and thus had no way to associate the upload with the post
> fully. Best I can tell, this value has to be set in the javascript. Once
> that was done both the Insert button showed up, and I had a correctly
> associated image, ie the attachment's parent value was set correctly. This
> was with a regular input with a file type and not a textarea, but sounds
> like similar enough symptoms. The little bit of javascript that worked for
> me, was adding the post_id to this statement:
>
>        tb_show('', 'media-upload.php?post_id=' + post_id +
> '&amp;type=image&amp;TB_iframe=true');
>
> The tutorial I first found, had left out that post_id part. Prior to this of
> course, the js post_id var would need to be set.
>
> -- Hal
>


More information about the wp-hackers mailing list