For the media library you can use the pre_get_posts
hook targeting upload.php
by means of $pagenow
, a global
variable, or even better, because globals are the devils child, by means of get_current_screen()
. I’m assuming you want to target the media modal tab too – because targeting only one, but not the other, doesn’t make much sense after all -, you can do that via the ajax_query_attachments_args
hook.