1

I have a taxonomy called ORGANIZER. All the terms of this taxonomy have a name and a description. I tried to get the description of each term but i don't know how to loop on them.

I suppose i mus begin with:

$terms = get_terms( array(
    'taxonomy' => 'organizer',
    'hide_empty' => false,
) );

but could you help me for the loop please ? thanks

2 Answers 2

1

get_terms() returns an array of WP_Term objects. To get the description, with the usual filters applied, you can pass this object to term_description():

$terms = get_terms( array(
    'taxonomy' => 'organizer',
    'hide_empty' => false,
) );

if ( ! is_wp_error( $terms ) ) {
    foreach ( $terms as $term ) {
        echo term_description( $term );
    }
}
0

@jacob peattie

Sorry I have no rights to add comments so i add another answer, i don't know how do to better...

It seems that get_terms() returns nothing but the organizer taxonomy exists and is not empty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.