I have a multisite installation of WordPress with 200+ sites. I recently was tasked to do an inventory of each site's media library and was wondering if this could be accomplished programmatically with a script? If so, what would be the most efficient way to query each site's media library?
-
I've tried using wp_get_sites() and then looping through them using the switch_to_blog() function but I've read that the switch_to_blog() function is resource intensive, which is something I have to be mindful of since it's the production server.. I'm assuming I can accomplish the same results using a custom query?– shapadaCommented May 3, 2016 at 20:09
-
so what, you not going to run this more then once in a blue moon, no?– Mark KaplunCommented May 3, 2016 at 20:14
-
Yeah, that's true.– shapadaCommented May 3, 2016 at 20:48
-
You could also backup the wp-content and database from production to a staging or dev system if you're worried about the load and run the inventory job on copy without loading the production system.– RupCommented May 3, 2016 at 22:18
-
Great idea, thanks for the suggestion - it's much appreciated.– shapadaCommented May 3, 2016 at 22:42
Add a comment
|
1 Answer
You may want to check this: How do I query all posts of one type across my multisite installation?
Just change post to media and you'll be fine.