$cats = array('taxonomy'=>'types');

$categories = get_categories($cats);
foreach($categories as $category) { 
    echo '<p>Category:'. $category->name.' </p> <br>';
    echo '<p> Description:'. $category->description . '</p> <br>';
    $term_id = $category->term_id;
    echo $term_id;
    $meta_image = wp_get_attachment_image($category->$term_id); 
    echo $meta_image; 
       <img src="<?=$meta_image?>" alt="image">

First of all $category->$term_id is wrong use $category->term_id

I don't think $category->$term_id will give you the desired result

For this you must have create some meta for the image in the backend.

term_image_id = get_term_meta( $category->term_id, 'your-term-id', true );

Here the term id is $category->term_id and the term value is your-term-id

Can you please check if that works or not?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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