Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

2 Answers 2

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

 
discard

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.