Find a random blogid that has at least one post published in multisite

I’m working on a weird little wordpress hack, and I’ve run up against the limits of my mysql/php knowledge.
I need to find a random blog across my multisite network that has at least one post published of a certain post_type, and return its blogid as a variable so I can use it in a
switch_to_blog()
call.I need to figure out how to build the $randomblog variable in this scenario:
// Find a random blog that has at least one post of post_type published and return its blogid as $randomblog (some kind of query across multisite network) // Switch to the random blog switch_to_blog($randomblog); (do some stuff) // Switch back to the current blog restore_current_blog();
Viewing 4 replies  1 through 4 (of 4 total)
Viewing 4 replies  1 through 4 (of 4 total)
 The topic ‘Find a random blogid that has at least one post published in multisite’ is closed to new replies.