[wp-hackers] Custom Post Types and Media Attachments

Becky Resler becky.absolute at gmail.com
Tue Dec 14 14:55:42 UTC 2010


John -

Thank you *so* much for figuring that out and posting your solution. I
was digging around in the code yesterday but couldn't find the right
spot that rendered that button. I had some other client stuff to work
on, so I moved on.

I tried out your code on my local install, and it appears to work just
fine. I need to do more testing of course, but so far so good. I did
notice that I had to click the 'Save Changes' button after the image
was uploaded and then go to the gallery or library in order to have
the *Insert into Post* button available, but that's something I think
I can deal with.

Thank you for opening a bug report on this topic. Could you possible
provide the link to that? I'd like to keep track of things.

Thanks again for figuring out a workaround. And I'm glad to know I'm
not the only one who encountered this issue.

Becky

On Tue, 14 Dec 2010 03:59:54 +0000, John Blackbourn
<johnbillion+wp at gmail.com> wrote:
> Okay I've just written some code which gets around this problem,
> albeit in a bit of a bizarre way.
>
> http://pastebin.com/hxnjJC1z
>
> Basically the function plugin_foo_insert_button_hack() is called when
> you upload a file, and at the top of the media browser. It checks the
> current post's post type for support for 'my_plugin_feature' and adds
> support for 'editor' in order to force the 'Insert Into Post' button
> to show up. It's wholly inelegant but it works and that's all I need
> at this moment in time, so it'll have to do.
>
> You'll probably need to tweak this to apply to your own
> plugin/situation, but hopefully this will be of help to someone else.
>
> I'll open a bug report in due course but I think the whole media
> management system is due an overhaul shortly (3.2?) so it might end up
> being a moot issue.


More information about the wp-hackers mailing list