Is there an argument for get_terms which I can fetch terms that only have say over 2 posts associated with it?

I have a terms page which lists all my terms for ‘artists’, the page is huge but a lot of these terms that only have one post so I would like to show only significant terms.

2 Answers
2

Give:

$terms = get_terms("my_taxonomy");
$count = count($terms);
if ( $count > 0 ){
    echo "<ul>";
    foreach ( $terms as $term ) {
        if ($term->count > 2) {
            echo "<li>" . $term->name . "</li>";
        }
    }
    echo "</ul>";
}

a shot. It will grab all the terms and then run a check to see if the $term->count is greater than 2 and if so, print out those terms.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *