How To Copy Sub-site Media to Admin Site on Upload (WordPress Multisite)

Jaysus, this one took me ages to understand. I spent so long doing all sorts of things to get it to work but in the end I think I’ve copped it. One important note though: do not remove the “restore_current_blog()” function at the end or move it within the if statement. You’ll end up in recursive hell with 50,000 weird ass database entries…