Create a gist now

Instantly share code, notes, and snippets.

<?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