Skip to content

Instantly share code, notes, and snippets.

@danemorgan
Last active December 23, 2015 01:18
Show Gist options
  • Save danemorgan/6559008 to your computer and use it in GitHub Desktop.
Save danemorgan/6559008 to your computer and use it in GitHub Desktop.
Count the number of posts currently published in a specific category, tag or custom taxonomy.
function posts_in_term($catid, $taxonomy) {
$term_query = get_term($catid, $taxonomy);
return $term_query->count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment