Skip to content

Instantly share code, notes, and snippets.

@BeardedGinger
Created May 4, 2016 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BeardedGinger/49b235f61bb1aa91a2e145d1ee47aa49 to your computer and use it in GitHub Desktop.
Save BeardedGinger/49b235f61bb1aa91a2e145d1ee47aa49 to your computer and use it in GitHub Desktop.
<?php
// Get the users blogs and loop through them
$blogs = get_blogs_of_user( $user_id );
foreach( $blogs as $blog ) {
switch_to_blog( $blog->userblog_id );
// Update the post count array with post count from each blog
$network_post_count[] = count_user_posts( $user_id );
restore_current_blog();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment