get_terms missing arguments
-
Hello,
get_terms its very useful to get taxonomy terms but something is missing with arguments like.
$tax_args = array( 'taxonomy' => 'sector', 'orderby' => 'name', 'order' => 'ASC', 'fields' => 'all', 'hide_empty' => true, 'pad_counts' => true ); $terms = get_terms( $tax_args ); Currently, we get sectors counts with post status draft means pad_counts also count draft post_status count So, there is should argument parameter for we can pass, $tax_args = array( 'taxonomy' => 'sector', 'orderby' => 'name', 'order' => 'ASC', 'fields' => 'all', 'hide_empty' => true, 'pad_counts' => true, 'post_status' => 'publish', 'post_type' => 'candidate' ); $terms = get_terms( $tax_args );
So, it will only count just publish posts count.
Thanks & Regards
Tushar Kataria
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_terms missing arguments’ is closed to new replies.