Ran into a problem with an image upload part of a theme feature.
The code uploaded at http://pastebin.com/Qnn2D36N (that's the entire script for adding the meta boxes) generates custom meta boxes on posts and pages, one of which has a media upload button.
On some installs it works as expected, on others going through the process works until clicking the "Insert into Post" button on the pop up media uploader. Goes back to the post, but the URL to the image isn't added to the form. On a localhost install I have multiple WordPress installations for testing and some work, others don't. On live sites on the same server, some work and some don't. I don't know why, on a clean install with no plugins installed it didn't work.
The code can be added to the TwentyEleven function.php file and it works with the same problems as I'm experiencing in the theme (Stallion) I develop, which suggests the problem is within the code.
With Debug mode on the media upload pop up window after clicking Media Library shows the following notice:
Notice: Undefined index: post_id in C:\wamp\www\0000000000\wp-admin\includes\media.php on line 1755
I get this notice on live sites, both sites that work and don't so it might not be the issue.
Viewing source of where the notice is located shows the post_id isn't part of the code, I see this:
<input type="hidden" value="0" name="post_id"/>
When viewing source of the media uploader when using the media uploader as part of the post (to add an image to a post normally) the post_id is located within value="".
I'm trying to remove this PHP notice to rule it out as the cause, I've tried adding "global $post_id;" in various parts of the script but no joy.
I'm stumped what to try next.