Function Reference

Display Category Image

1 min read Updated Jan 26, 2026

In Category Archive

Use the following code snippet to display the category image for the currently displayed category in taxonomy-wpdmcategory.php:

$category_obj = get_queried_object();  
$category = WPDM()->category->get($category_obj->term_id); // Make sure $term_id is set
echo '<img src="' . $category->icon . '" alt="' . $category->name . '" />';

Somewhere Else

Use the following code snippet to display the category image for the provided category term:

$category = WPDM()->category->get($term_id); // Make sure $term_id is set
echo '<img src="' . $category->icon . '" alt="' . $category->name . '" />';