[wp-hackers] Getting context inside the add_attachment hook

Ricardo Moraleida moraleida at gmail.com
Fri Oct 5 20:39:18 UTC 2012


is there a way to find out from which page the media_uploader was called
inside the add_attachment hook (i.e right after each upload completes) ?

I've tried passing GET values to media-upload.php and using
is_page('pagename'), but still no dice.

The case use is that I'd like to invert the process of creating posts for a
custom post type. Instead of creating a post and uploading an image,
uploading images/files would create a post and attach themselves to it
automatically. It's doable inside add_attachment, but i need to constrain
this to happen only to a specific post type.


Ricardo Moraleida

More information about the wp-hackers mailing list