Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Tsunamijaan/d772853d7e2753d3029908b93baa49f9 to your computer and use it in GitHub Desktop.

Select an option

Save Tsunamijaan/d772853d7e2753d3029908b93baa49f9 to your computer and use it in GitHub Desktop.
Get author post count inside & outside loop
Inside loop:
First get user id
Then get post count in loop
$author_id= get_the_author_meta('ID');
echo count_user_posts( $author_id );
===========Outside loop==========
echo count_user_posts( 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment