WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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? :)

share|improve this question
up vote 1 down vote accepted

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

share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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