Don’t show avatars in media library

Like most page loads in WordPress, WP_Query is intimately involved meaning pre_get_posts is your friend. Proof of concept:

function step_2($qry) {
  $qry->set('post__not_in',array(468,303));
}
function step_1() {
  add_action('pre_get_posts','step_2');
}
add_action('load-upload.php','step_1');

I’m using the load-upload.php hook to isolate the filter to the “Library” page. If you’ve changed the uploads folder for your avatars you’ve already got some “upload” code in place. You will need to extend that to track your avatar IDs and retrieve them instead of hard-coding as I did. It might be possible to use some other mechanism to filter the results as well.

While I haven’t tested this, if you were to upload as some other post type than “attachment” the rest would probably fall into place without further effort.