I'm trying to modify wp_nav_menu to display term thumbnails. To get those thumbnails I need term ID and taxonomy slug: $thumbnailimg = get_the_term_thumbnail($term_id, '$taxonomy', 'medium');

I managed to get term ID for it with: $term_id = (int)$item->object_id;

But now I need to check if that object is a term AND what custom taxonomy that term belongs to (I have 2 of them).

Can anyone help me to solve this problem? :)

2 Answers 2


For a menu object $item:

  • $item->object stores the object the menu item refers to, e.g. 'post', 'page', 'my-cpt', or 'my-taxonomy' (the post type name, or the taxonomy name)
  • $item->type stores what 'type' of object is it, either: 'post_type' or 'taxonomy'.

For custom links, these are both custom


See if these functions will work for what you are trying to do:

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.