This code worksThis code works for me if I go to upload a file and choose the Gallery or Media Library tabs then it correctly hides elements on the page.
If I go to the From Computer or From URL tabs, nothing is hidden!
If I take out the if statement then it works. I can't see why it shouldn't be working on these 2 tabs as the URLs are the same apart from the tab parameter and the if statement is only checking the post_id:
Gallery tab works: /wp-admin/media-upload.php?post_id=4&type=image&tab=gallery
From Computer tab doesn't work: /wp-admin/media-upload.php?post_id=4&type=image&tab=type
Edit
On pages using my custom post type I am passing through the parameter of type=image to the media uploader. For 2 of the tabs my code within the if statement is not being executed:
The other 2 tabs on the media uploader popup do what I want:
If I have the if statement as:
if ($_GET['type'] == 'image')
Then it still doesnt trigger the code on From Computer or Gallery Tab so I can't rely on the querystring?
Any ideas?