[This code works][1] 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:

![2 tabs still showing all information][2]

The other 2 tabs on the media uploader popup do what I want:

![Code running correctly][3]

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?


  [1]: http://wordpress.stackexchange.com/questions/51546/how-to-removing-fields-from-the-media-uploader-gallery-on-a-custom-post-type-edi
  [2]: https://i.sstatic.net/Aic4x.jpg
  [3]: https://i.sstatic.net/C0vrw.jpg