-1

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?

5
  • 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?
    – shapada
    Commented May 3, 2016 at 20:09
  • so what, you not going to run this more then once in a blue moon, no? Commented May 3, 2016 at 20:14
  • Yeah, that's true.
    – shapada
    Commented 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.
    – Rup
    Commented May 3, 2016 at 22:18
  • Great idea, thanks for the suggestion - it's much appreciated.
    – shapada
    Commented May 3, 2016 at 22:42

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.