Get Post Count for Multiple Tags
-
I’m trying to get the post count of 10 of hundreds of tags. At first I thought about using get_terms, but getting the terms of all the tags takes way too much time. So I’m trying to pass the args of the tag slugs. I’ve tried multiple ways to set up the array, but none seem to work.
I’ve tried a few things:
$args= array('tag__in' => array('1', '3', '5')); $alltags = get_terms('post_tag', $args);
That just locks the page up.
I’ve tried this as well:
$args = array( 'slug'=>array('slug1', 'slug2', 'slug3')); $alltags = get_terms('post_tag', $args);
And I’ve tried different variations of each.
Any thoughts on how to pull the post count on a set of tags? I could do multiple get_terms with each slug but I’m trying to have 1 database pull and not 10. Thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Get Post Count for Multiple Tags’ is closed to new replies.