Extra Icon adds an image/icon field to categories & tags and to posts & pages, plus a
function wpc_get_icon() to output the saved icon.
Enabling
Turn on Tools → Site Tools → Enable Extra Icon. The wpc_get_icon() function only exists while
that toggle is on.
Where the field appears
- Categories and Tags — an “Image” field on the term edit screen.
- Posts & Pages — an “Icon” metabox in the editor.
The field has Upload image / Remove image buttons that open the media library, plus a live
preview.
⚠ The taxonomy field is added only for the built-in category and post_tag taxonomies (not
custom taxonomies), and only on the Edit term screen. The metabox is added only for posts and
pages, not custom post types.
What you can store
The field accepts either:
- an image URL (typically picked from the media library), or
- a CSS class string (e.g. an icon-font class like
fas fa-star).
wpc_get_icon() renders the right markup for whichever you stored.
Outputting the icon — wpc_get_icon( $type, $id )
Returns the icon HTML (empty string when nothing is set).
// Category / Tag icon (term ID):
echo wpc_get_icon( 'tax', $term_id );
// Post / Page icon (post ID):
echo wpc_get_icon( 'post', get_the_ID() );
| Argument | Values |
|---|---|
$type |
tax (category/tag) or post (post/page). |
$id |
Term ID or post ID. |
What it returns
| Stored value | Output |
|---|---|
| Image URL (from the media library) | A responsive <img> tag with srcset/sizes. |
| Image URL (no attachment) | A plain <img> tag. |
| A CSS class string | A <span class="…"></span>. |
| Empty / missing | empty string. |
Example — an icon next to a category name:
$cat = get_queried_object();
echo wpc_get_icon( 'tax', $cat->term_id ) . esc_html( $cat->name );
⚠ The function only exists while Enable Extra Icon is on — in templates shared across sites,
guard calls with function_exists( 'wpc_get_icon' ).